Last active
June 10, 2019 12:29
-
-
Save hjJunior/a354866407fd95bb885a6aeb6a5b89db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@JsonSerializable(nullable: false) | |
class Person { | |
final String firstName; | |
final String lastName; | |
Person({this.firstName, this.lastName}); | |
factory Person.fromJson(Map<String, dynamic> json) => _$PersonFromJson(json); | |
Map<String, dynamic> toJson() => _$PersonToJson(this); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Person _$PersonFromJson(Map<String, dynamic> json) { | |
return Person( | |
firstName: json['firstName'] as String, | |
lastName: json['lastName'] as String); | |
} | |
Map<String, dynamic> _$PersonToJson(Person instance) => <String, dynamic>{ | |
'firstName': instance.firstName, | |
'lastName': instance.lastName | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment