stefanmuke
stefanmuke

Reputation: 399

Generate a flutter list from a Cloud Firestore query

I am trying to generate a list containing the 'name' parameters as Strings from this Firestore.instance.collection('videos').limit(10).snapshots(); query, but I am having trouble extracting the parameter values from the documents and returning them as a list. Would I have to use .forEach() or do I have to .map() the entries to a list? Any help would be highly appreciated!

Edit: Additionally I would like to query the documents in a certain range, but .startAt() does not seem to accept integers. Is there any way to query say the first 10 documents by using Firestore.instance.collection('videos').startAt(0).limit(10).snapshots();?

Upvotes: 0

Views: 5363

Answers (1)

Wm Leler
Wm Leler

Reputation: 251

There is an example of doing this using a StreamBuilder at https://pub.dartlang.org/packages/cloud_firestore#-example-tab-

Upvotes: 1

Related Questions