Open jrheisler opened 3 years ago
As always, the second you give you, you find your problem. It's in the fromMap(data) end. Data is now a method, so it gets read:
name: data()['name'] ?? '',
Hello, so for this project specifically.....if you are trying to update to the current version of firebase it is important to place the parenthesis for data method in your Globals.dart
OLD
// Data Models
static final Map models = {
Topic: (data) => Topic.fromMap(data),
Quiz: (data) => Quiz.fromMap(data),
Report: (data) => Report.fromMap(data)
};
NEW
// Data Models
static final Map models = {
Topic: (data) => Topic.fromMap(data()),
Quiz: (data) => Quiz.fromMap(data()),
Report: (data) => Report.fromMap(data())
};
Lots to do to upgrade to the latest firebase. This one has me stumped. The Collection method:
Stream<List> streamData() {
return ref.snapshots().map((list) => list.documents.map((doc) => Global.modelsT as T) );
}
gives:
Expected a value of type 'Map<dynamic, dynamic>', but got one of type '() => Map<String, dynamic>'