Landen

Landen

Het pakket bevat 248+ landen met volledige ISO 3166-1-metadata.

Landeigenschappen

Elk land heeft de volgende velden:

VeldBeschrijving
alpha2CodeISO 3166-1 alfa-2-code (bijv. "US")
alpha3CodeISO 3166-1 alfa-3-code (bijv. "USA")
numericCodeISO 3166-1 numerieke code (bijv. 840)
nativeNameOorspronkelijke landnaam
capitalHoofdstad
mainLanguagePrimaire taalcode
languagesLijst van gesproken taalcodes
tldTopniveaudomein (bijv. ".us")
callingCodeInternationaal landnummer (bijv. 1)
continentContinentidentificatie
currencyPrimaire valutacode

Opzoeken op code

Alfa-2-code

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

Alfa-3-code

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

Numerieke code (alleen Dart)

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

Alle landen weergeven

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

Filteren op continent

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

SVG-vlaggen

Elk land heeft een inline SVG-vlag beschikbaar als string.

GoDartTypeScript
// Toegang via de countryFlags-map
final svg = countryFlags['US'];

// Of via de Country-eigenschap
final country = Country.fromAlpha2Code('US');
final flagSvg = country?.flagSvg;

// Weergeven als Flutter-widget
country?.flag(
  shape: FlagShape.rectangle,
  width: 32,
  height: 24,
);

Emojivlaggen

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

Landmetadata

GoDartTypeScript
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