Countries

Countries

The package includes 248+ countries with full ISO 3166-1 metadata.

Country Properties

Each country has the following fields:

FieldDescription
alpha2CodeISO 3166-1 alpha-2 code (e.g. "US")
alpha3CodeISO 3166-1 alpha-3 code (e.g. "USA")
numericCodeISO 3166-1 numeric code (e.g. 840)
nativeNameNative country name
capitalCapital city
mainLanguagePrimary language code
languagesList of spoken language codes
tldTop-level domain (e.g. ".us")
callingCodeInternational calling code (e.g. 1)
continentContinent identifier
currencyPrimary currency code

Lookup by Code

Alpha-2 Code

final country = Country.fromAlpha2Code('US');
print(country?.nativeName); // United States
print(country?.capital);    // Washington, D.C.

Alpha-3 Code

final country = Country.fromAlpha3Code('USA');
print(country?.alpha2Code); // US

Numeric Code (Dart only)

final country = Country.fromNumericCode(840);
print(country?.nativeName); // United States

List All Countries

final allCountries = Country.values;
print(allCountries.length); // 253

Filter by Continent

final european = Continent.europe.countries;
for (final c in european) {
  print(c.nativeName);
}

SVG Flags

Each country has an inline SVG flag available as a string.

// Access via the countryFlags map
final svg = countryFlags['US'];

// Or via the Country property
final country = Country.fromAlpha2Code('US');
final flagSvg = country?.flagSvg;

// Render as a Flutter widget
country?.flag(
  shape: FlagShape.rectangle,
  width: 32,
  height: 24,
);

Emoji Flags

final country = Country.fromAlpha2Code('US');
print(country?.emojiFlag);

Country Metadata

final country = Country.fromAlpha2Code('JP');
print(country?.callingCode);          // 81
print(country?.tld);                  // .jp
print(country?.currency.code);        // JPY
print(country?.continent.code);       // AS
print(country?.mainLanguage.code);    // ja