Reputation: 197
I am trying to retrieve user data that I stored on firebase database and compare it to an inputed text "trying to login but with another way ;)" but when I search for examples I can't quite understand their methods of retrieving data they don't retrieve specific data but the collection, so any ideas?
Upvotes: 2
Views: 2110
Reputation: 188
You can use the "where" function in firestore
FirebaseFirestore.instance
.collection('users')
.where('email', isEqualTo: your_text_controller)
.get()
.then(...);
Upvotes: 0
Reputation: 80914
To get the data you need to do the following:
void getUserData() async{
var firebaseUser = await FirebaseAuth.instance.currentUser();
firestoreInstance.collection("users").document(firebaseUser.uid).get().then((value){
print(value.data);
});
}
Assuming you are using Firebase authentication as the document id
Upvotes: 1