Created
May 24, 2020 00:02
-
-
Save rodolfofranco/b55650ae7d548b808ed63b3c8143fae0 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
class Country { | |
final String name; | |
final String capital; | |
Country({this.name, this.capital}); | |
Map<String, dynamic> toJson() => {'name': name, 'capital': capital}; | |
factory Country.fromMap(Map data) { | |
data = data ?? {}; | |
return Country( | |
name: data['name'] ?? null, capital: data['capital'] ?? null); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment