Reputation: 657
How to get field level data from firebase?
I want values of certain field from all documents in a collection, What should I add? Heres my code,
Future<void> fetchAndSetData() {
FirebaseFirestore.instance
.collection('Reservations')
.get()
.then((value) {
print(value.docs.map((e) => e.data()));
});
}
and this is what I get in console
( 461): ({}, {seats: [104A, 104B], tableNo: 104})
Upvotes: 0
Views: 151
Reputation: 154
Changed the method like this
Future<void> fetchAndSetData() {
FirebaseFirestore.instance
.collection('Reservations')
.get()
.then((value) {
print(value.docs.map((e) => e['seats']));
});
}
Upvotes: 2