This is the code that im developing to get a collection from Firestore and store all its data in another map
onPressed: () async {
Map<String, dynamic> data = {};
await FirebaseFirestore.instance.collection('primary').get() .then((values) {
for (var I in values.docs) {
data.addAll(i.data());
}
print(data);
});
},
if I just print i.id, I will get all 9 ids that are available. But, by doing this to copy all the data from the map, when I print the Map data, Im only Storting the last value. Ive tried to use forEach but happened the same