I'm getting the error on the code "snapshot.Data()". This is one of the breaking changes to Firestore, and snapshot is now of type "DocumentSnapshot<Object?>".
BREAKING: Getting a snapshots' data via the data getter is now done via the data() method.
The example supplied in the new documentation wasn't helpful for me.
"The argument type 'Object?' can't be assigned to the parameter type 'Map<String, dynamic>'"
I've tried a number of combinations, but I can't get rid of the error. Also, I'm not using a stream, I just want to read the single record.
Here is the code:
var snapshot = await _reference.doc(_user.uid).get();
return UserData.fromMap(snapshot.data());
Here is the model "fromMap":
factory UserData.fromMap(Map<String, dynamic> map) {
return UserData(
birthday: DateTime.fromMillisecondsSinceEpoch(map['birthday']),
gender: map['gender'],
isDarkMode: map['isDarkMode'],
isMetric: map['isMetric'],
name: map['name'],
password: map['password'],
);
}