2

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? enter image description here

Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
omar developer
  • 189
  • 1
  • 3
  • 13

2 Answers2

1

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

Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
0

You can use the "where" function in firestore

FirebaseFirestore.instance
.collection('users')
.where('email', isEqualTo: your_text_controller)
.get()
.then(...);
Saffron-codes
  • 158
  • 1
  • 9