I have a freezed class which looks like this -
@freezed
abstract class User with _$User {
factory User(
{@required String uid,
String firstName,
String lastName,
String email,
Map<String, dynamic> pictures,
@Default(false) bool isAdmin}) = _User;
factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);
}
This class is saved in cloud firestore and I am using this to read it:
User user = User.fromJson(dataFromFirebase);
But I get this error while reading it:
#0 _$_$_UserFromJson (package:my_app/freezed/freezed_classes.g.dart:15:32)
#1 new _$_User.fromJson (package:my_app/freezed/freezed_classes.freezed.dart:68:7)
#2 _$UserFromJson (package:my_app/freezed/freezed_classes.freezed.dart:11:16)
#3 new User.fromJson (package:my_app/freezed/freezed_classes.dart:18:55)
#4 FirestoreService.getUserInfo (package:my_app/services/firestore_service.dart:75:22)
<asynchronous suspension>
#5 FirebaseAuthService.currUserFromUserCollection (package:my_app/services/firebase_auth_service.dart:27:53)
#6 FirebaseAuthService._userFromFirebase (package:my_app/services/firebase_auth_service.dart:17:27)
#7 FirebaseAuthService.signInWithEmailAndPassword (package:my_app/services/firebase_auth_service.dart:47:12)
<asynchronous suspension>
#8 EmailPasswordSignInModel.submit (package:finc<…>
Does anyone know what might be going on here ? I tried using and as types for my Map class (it has a String key and a String value) but still throws the same exception.