I am trying a filter a list of documents from a collection, one of a field in collection is Taskassignedto this field if equal to current user email.
i am trying to get data by using following code
return await Firestore.instance.collection('Task').getDocuments();
i need to filter the collection where Taskassigned to is equal to current user email. Appreciate the help.
Try the following:
var firebaseUser = await FirebaseAuth.instance.currentUser();
return await Firestore.instance.collection('Task').where("Taskassigned", isEqualTo: firebaseUser.email).getDocuments();
where()
query will check Taskassigned
to is equal to current user email
final FirebaseUser user = await auth.currentUser();
final useremail = user.email;
return await Firestore.instance
.collection('Task')
.where(
'Taskgivento',
).where("Taskgivento",isEqualTo: useremail)
.getDocuments();
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.