title: How to retrieve data collection from cloud firestore database
body: <p>I am trying to retrieve all the fields in my collection, but i am only able to retrieve one field in the collection <code>personalinfo</code> instead of the entire content of the collection. Is there a way to retrieve all the fields in the collection of <code>personalinfo</code>?</p>
  <p>this are my code to save data to cloud firestore database</p>
  <pre><code>import 'package:cloud_firestore/cloud_firestore.dart';
  import 'package:flutter/cupertino.dart';
  import 'package:flutter/material.dart';
  import 'package:get/get.dart';
  import 'package:grocery_shopping/pages/order_successful/order_successful.dart';
  
  class PersonalInformation extends StatelessWidget {
     PersonalInformation ({Key? key}) : super(key: key);
  
    TextEditingController fullname = new TextEditingController();
     TextEditingController address = new TextEditingController();
     TextEditingController city = new TextEditingController();
     TextEditingController zipcode = new TextEditingController();
  
    @override
    Widget build(BuildContext context) {
  
  
  
      return Scaffold(
        appBar: AppBar(title: Text(&quot;Checkout&quot;)),
        body: Container(
          padding: EdgeInsets.all(40.0),
          child: Center(
            child: Column(
              children: [
                TextFormField(
                  controller: fullname,
                  decoration: InputDecoration(
                  hintText: &quot;Full Name&quot;
                  ),
                ),
                SizedBox(
                  height: 10.0,
                ),
                TextFormField(
                  controller: address,
                  decoration: InputDecoration(
                      hintText: &quot;Address&quot;
                  ),
                ),
                SizedBox(
                  height: 10.0,
                ),
                TextFormField(
                  controller: city,
                  decoration: InputDecoration(
                      hintText: &quot;City&quot;
                  ),
                ),
                SizedBox(
                  height: 10.0,
                ),
                TextFormField(
                  controller: zipcode,
                  decoration: InputDecoration(
                      hintText: &quot;Zipcode&quot;
                  ),
                ),
                SizedBox(
                  height: 10.0,
                ),
                TextButton(
                    onPressed: (){
                    Map &lt;String,dynamic&gt; data= {&quot;field1&quot;: fullname.text,&quot;field2&quot;: address.text,&quot;field3&quot;: city.text, &quot;field4&quot;: zipcode.text};
                    FirebaseFirestore.instance.collection(&quot;personalinfo&quot;).add(data);
                    } ,
                    child: Text(&quot;Submit&quot;),
                ),
  
  
                TextButton(
                  onPressed: () {
                   Navigator.push(context, MaterialPageRoute(builder: (BuildContext context)=&gt; OrderSuccessful()));
                  },
  
                  child: Text(&quot;Continue&quot;),
                ),
  
                ElevatedButton(
                  onPressed: () =&gt; Get.to(() =&gt; OrderSuccessful()),
                  child: Text('Continue'),
                ),
              ],
            ),
          ),
        )
      );
    }
  }
  </code></pre>
  <p>this are my code for the data retrieve in cloud firestore database</p>
  <pre><code>import 'package:cloud_firestore/cloud_firestore.dart';
  import 'package:flutter/material.dart';
  
  class OrderSuccessful extends StatefulWidget {
    @override
    _OrderSuccessfulState createState() =&gt; _OrderSuccessfulState();
  }
  
    class _OrderSuccessfulState extends State&lt;OrderSuccessful&gt;{
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(title: Text(&quot;Order Successful&quot;)),
        resizeToAvoidBottomInset: true,
  
        body: StreamBuilder(
          stream: FirebaseFirestore.instance.collection('personalinfo').snapshots(),
          builder: (BuildContext context, AsyncSnapshot&lt;QuerySnapshot&gt; snapshot){
          if (!snapshot.hasData){
            return Text(&quot;no value&quot;);
          }
          return ListView(
            children: snapshot.data!.docs.map((document){
              return Text(document['field1']);
            }).toList(),
          );
          },
          ),
      );
    }
  }
  </code></pre>