Home > Back-end >  Can I get data from firebase firestore without putting it in a list in flutter?
Can I get data from firebase firestore without putting it in a list in flutter?

Time:04-20

Is it possible to get data from firebase firestore without putting it in a list/listview in Flutter? How?

CodePudding user response:

Yes you can do like this to get data from firebase.

FirebaseFirestore.instance.collection('users').doc(userId).get().then((DocumentSnapshot documentSnapshot) {
  if (documentSnapshot.exists) {
    print('Document data: ${documentSnapshot.data()}');
  } else {
    print('Document does not exist on the database');
  }
});

CodePudding user response:

Yes

FirebaseFirestore.instance.collection('users').get().then()
.then((value) {
//in value you have saved the data on it and you can use it whenever you want 
});

CodePudding user response:

Yes you can get data

DocumentSnapshot documentSnapshot = FirebaseFirestore.instance.collection('collection').get()
Var data = documentSnapshot.data();
  • Related