'Flutter Cloud Firestore: error: The argument type 'Object? Function()' can't be assigned to the parameter type 'Map<String, dynamic>'
I am trying to update some code which used an old Firestore version which is version 0.9.13 and I am updating it to the latest version. This code should pull data and populate a graph.
I have tried downgrading and upgrading to find a version that works, I can't seem to find a working version. There is a suggestion of adding a new argument to the model however I am unsure if this is the correct method.
Error Message:
error: The argument type 'Object? Function()' can't be assigned to the parameter type 'Map<String, dynamic>'. (argument_type_not_assignable at [firebase] lib\code\moodhomepage.dart:47)
Code:
Widget _buildBody(BuildContext context) {
return StreamBuilder<QuerySnapshot>(
stream: FirebaseFirestore.instance.collection('moods').snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return LinearProgressIndicator();
} else {
List<Mood> mood = snapshot.data!.docs
.map((documentSnapshot) => Mood.fromMap(documentSnapshot.data))
.toList();
return _buildChart(context, mood);
}
},
);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
