'Can I get data from firebase firestore without putting it in a list in flutter?

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



Solution 1:[1]

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');
  }
});

Solution 2:[2]

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 
});

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kishan Busa
Solution 2 Jack