xxxxxxxxxx
var collection = FirebaseFirestore.instance.collection('users');
var docSnapshot = await collection.doc('some_id').get();
if (docSnapshot.exists) {
Map<String, dynamic> data = docSnapshot.data()!;
// You can then retrieve the value from the Map like this:
var name = data['name'];
}
xxxxxxxxxx
var collection = FirebaseFirestore.instance.collection('users');
collection.doc('some_id').snapshots().listen((docSnapshot) {
if (docSnapshot.exists) {
Map<String, dynamic> data = docSnapshot.data()!;
// You can then retrieve the value from the Map like this:
var name = data['name'];
}
});