Country.fromJson constructor
Convert Countries.countryList to Country model
Implementation
factory Country.fromJson(Map<String, dynamic> data) {
return Country(
name: data['en_short_name'],
alpha2Code: data['alpha_2_code'],
alpha3Code: data['alpha_3_code'],
dialCode: data['dial_code'],
flagUri: 'assets/flags/${data['alpha_2_code'].toLowerCase()}.png',
nameTranslations: data['nameTranslations'] != null
? Map<String, String>.from(data['nameTranslations'])
: null,
);
}