countries_list 0.1.1 copy "countries_list: ^0.1.1" to clipboard
countries_list: ^0.1.1 copied to clipboard

outdated

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;
    }
  }
}
0
likes
0
pub points
31%
popularity

Publisher

unverified uploader

Just list of countries, and nothing else. You can use it for creating your own country picker.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on countries_list