countries_list 0.1.1 countries_list: ^0.1.1 copied to clipboard
Just list of countries, and nothing else. You can use it for creating your own country picker.
countries_list #
Simply, list of countries. I used json from this repo ISO-3166-Countries-with-Regional-Codes
Main methods: #
// return list of all countries
Future<List<Country>> getCountriesIso();
// return list of all countries which has phone codes
Future<List<Country>> getCountriesOnlyWithPhoneCode();
Country class: #
class Country {
final String latinName;
final CountryIso countryIso;
final String phoneCode;
final String flag;
Country({
@required this.latinName,
@required this.countryIso,
@required this.phoneCode,
@required this.flag,
});
@override
String toString() {
return '$latinName (${countryIso.alpha2}), +$phoneCode, $flag';
}
bool contains(String t) {
try {
return latinName.toLowerCase().contains(t.toLowerCase()) ||
phoneCode.toLowerCase().contains(t.toLowerCase()) ||
countryIso.alpha2.toLowerCase().contains(t.toLowerCase()) ||
countryIso.alpha3.toLowerCase().contains(t.toLowerCase());
} catch (error) {
return false;
}
}
}