I make an app in Flutter with Firestore now I would go through all documents in a collection and I want to get the document name (id) and the field of the documents and do something with that. I have already make a listview where the data is displayed but I can't do something with that, for example, add it to a list or something. Thanks
You can do that by getting list of documents like:
final QuerySnapshot result =
await Firestore.instance.collection('myCollection').getDocuments();
final List<DocumentSnapshot> documents = result.documents;
And after that you can iterate this list and get data:
documents.forEach((data) => print(data));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With