Flutter filter list based on email of current user

276 views
Skip to first unread message

Raviteja Reddy

unread,
Apr 24, 2020, 3:27:36 PM4/24/20
to Flutter Development (flutter-dev)

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.tried this
return await Firestore.instance.collection('Task').where('Taskassignedto',isequalto:email).getDocuments();

getting an error getter email isnt defined for the class FirebaseUser

Suzuki Tomohiro

unread,
Apr 24, 2020, 7:30:45 PM4/24/20
to Flutter Development (flutter-dev)
I guess the error is coming from somewhere else. Do you want to share the exact error message and source code? Line numbers matter.

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/77606a22-f323-45fd-89a5-e1966f28112d%40googlegroups.com.

Tom Gilmour

unread,
Apr 25, 2020, 9:27:00 AM4/25/20
to Suzuki Tomohiro, Flutter Development (flutter-dev)
The problem could be many things. Please share your code to shed light on the issue. It could be:

1. An issue with async and waiting for the email to come back from Firebase.

2. Are you using the correct method of getting email from firebase? 

Finally, you may want to store email on the device using shared preferences if you’re using it as an ID. Personally I would get the user Id generated by Firebase auth, store that locally and use that instead of email to identify a document associated to a user. That way you’re not storing and proliferating personal info in your records solely for searching purposes.



Reply all
Reply to author
Forward
0 new messages