Replies: 1 comment 6 replies
-
Hello @frank06 , please help me. I need an anwser. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to use complex nested classes so i have this two classes
@JsonSerializable(explicitToJson: true)
@DataRepository([JsonServerAdapter])
class User extends DataModel {
final String? id;
final String firstName;
final String lastName;
final List role;
}
AND
class Role extends DataModel {
final String? id;
final String libelleRole;
}
All things work well, i can save data in local but when i use hot reload, i get this error :
flutter: [flutter_data] Box failed to open:
type '_Map<dynamic, dynamic>' is not a subtype of type 'Map<String, dynamic>'
#0 _$UserFromJson. user.g.dart:62
AND
this is the line 62 of user.g.dart file
User _$UserFromJson(Map<String, dynamic> json) => User(
id: json['_id'] as String?,
firstName: json['firstName'] as String,
lastName: json['lastName'] as String,
email: json['email'] as String,
password: json['password'] as String,
(Line62)role: (json['role'] as List)
.map((e) => Role.fromJson(e as Map<String, dynamic>))
.toList(),
);
Please can you help me ?
Beta Was this translation helpful? Give feedback.
All reactions