I am creating an application where I need to have 3 heirarchy for email folders and notes like this:
Now I’m not able to get the list of documents under the folder collection.
I have tried this till now:
var collection = FirebaseFirestore.instance
.collection('user')
.doc(widget.email)
.collection('folder2');
await collection.get().then((snap) {
data = snap.size;
print(data);
});
But this is just giving me 0 in the console, but showing all the entries for the notes collection so what should I do?
2
Answers
So I did get all the documents in the folder level by simply adding a few fields in that Collection like name, description etc. Though I still don't see a way to get all the documents containing subcollections without adding any fields.
try using the length of the documents retrieved in the result.