I'm a flutter null-safe noob. I used the code below, but I am getting this error:
The argument type 'Map<String, dynamic>?' can't be assigned to the parameter type 'Map<String, dynamic>'
This does seem like a null-safe issue but then again it may be that one has to do this getting a stream of documents different in null safety.
class DataService {
final _dataStore = FirebaseFirestore.instance;
Stream <List<Shop>> listAllShops() {
return _dataStore.collection('shops')
.snapshots()
.map((snapshot) => snapshot.docs
.map((document) => Shop.fromJson(document.data())) <<< error comes here
.toList());
}
}
I have tried putting a ? in various places but nothing worked.