I have a collection named requests
and inside that collection I have many Document. I want to get the Id of each document present inside that collection
Firestore.instance
.collection(FirebaseCollection.user)
.where(UserCollectionField.mobile, isEqualTo: mobile)
.getDocuments()
.then((snapshot) {
var id = snapshot.documents[0].documentID;
}).catchError((error) {
});
also you can make list of user id ex.
Firestore.instance
.collection(FirebaseCollection.user)
.where(UserCollectionField.mobile, isEqualTo: mobile)
.getDocuments()
.then((querySnapshot) async {
var list = querySnapshot.documents;
list.forEach((document) {
adminlist.add(document.documentID);
});
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.