I am building a desktop application for Windows using Flutter. I am trying to retrieve all of the documents IDs from a collection in FireStore using the package firedart (as the official FireStore package does not support Windows).
This is a simple code to get the documents from a collection:
FirebaseAuth.initialize(apiKey, VolatileStore());
Firestore.initialize(projectId);
CollectionReference stream = Firestore.instance.collection('users');
final data = await stream.get();
print(data);
The output of this print will be a list of arrays where each one has the path to the document and the values sorted inside the document.
for example:
How can I print the Ids only to a list?
2
Answers
As I found from linked package’s docs, API of the library you are using is similar to the official one.
This answer might help – you can get document ID when you have a reference to the document
you can get id from this collection by convert value to string and split this string to get it
”’
”’
”’