Home > Software engineering >  Flutter The argument type 'Object?' can't be assigned to the parameter type 'Map
Flutter The argument type 'Object?' can't be assigned to the parameter type 'Map

Time:02-22

The argument type 'Object?' can't be assigned to the parameter type 'Map<String, dynamic>'. I didn't understand how to solve this.

 @override
Future<List<Users>?> getAllUsers() async {
QuerySnapshot querySnapshot = await firestore.collection("users").get();
List<Users> allUsers = [];

allUsers = querySnapshot.docs.map((e) => Users.fromMap(e.data())).toList();
return allUsers;
}

CodePudding user response:

QuerySnapshot<Map<String, dynamic>> querySnapshot = await firestore.collection("users").get();
  • Related