A lite dart package for providing offline World Countires Data with helpful utils to your dart or flutter application
[note] : this packege it migrated from the old flutter_countries name to countries_utils to make it suitable for all dart projects with no flutter dependecy.
depend on the package in your pubspec.yaml
dependencies:
countries_utils: <last_version>
get the packages :
flutter pub get
This is a list of the properties that can be provided for each country
Parameter | Return Type | Output Example |
---|---|---|
name | String | Egypt |
nativeName | TranslationList | جمهورية مصر العربية |
translations | TranslationList | TranslationList(translations:List) |
demonym | String | 'Egyptian' |
altSpellings | List | [ "EG" , "Arab Republic of Egypt" ] |
alpha2Code | String | EG |
alpha3Code | String | EGY |
numericCode | String | 818 |
topLevelDomain | List | ['.eg'] |
capital | String | Cairo |
region | String | Africa |
currnecies | CurrencyList | CurrencyList(currencies:List); |
languages | Map<String, dynamic> | { 'eng' : 'English' , 'ara' : 'Arabic ' } |
borders | List | ["LBY","PSE","SDN"] |
area [in km] | double | 1002450.0 |
flags | List | ["https://restcountries.com/data/egy.svg","https://restcountries.com/data/png/egy.png"] |
flagIcon | String | [🇪🇬] |
phoneCode | List | +20 |
latitiude | double | 27 |
longitude | double | 30 |
This is a list of the methods you can get country data by :
Method | Return Type | Description | Example |
---|---|---|---|
all() | List | get all countries data | Countries.all() |
byName() | Country | get country by name | Countries.byName('Egypt') |
byCode() | Country | get country by alpha2 code | Countries.byCode('EG') |
byAlph3Code() | Country | get country by alpha3 code | Countries.byAlpha3Code('EGY') |
byNumericCode() | Country | get country by numeric code | Countries.byNumericCode('818') |
byCallingCodes() | Country | get country by phone code | Countries.byCallingCodes('+20') |
byCapital() | Country | get country by capital | Countries.byCapital('Cairo') |
byFlag() | Country | get country by flag emoji | Countries.byFlag('🇪🇬') |
byLanguageCode() | List | get country by language code | Countries.byLanguageCode('ara') |
byLanguageName() | List | get country by language name | Countries.byLanguageName('Arabic') |
unMembers() | List | get UN Members countries | Countries.unMembers() |
byRegion() | List | get countries by region | Countries.byRegion('Africa') |
byArea() | Country | get countries by area | Countries.byArea(1002450) |
areaBiggerThan() | List | get countries Bigger than given area | Countries.areaBiggerThan(1002450) |
areaSmallerThan() | List | get countries Smaller than given area | Countries.areaSmallerThan(1002450) |
Want to contribute? Great 😄 .. all good contributions to this package are welcome
thanks for amatos for the json country data