Länder

Länder

Das Paket enthält 248+ Länder mit vollständigen ISO 3166-1-Metadaten.

Ländereigenschaften

Jedes Land hat die folgenden Felder:

FeldBeschreibung
alpha2CodeISO 3166-1 Alpha-2-Code (z.B. "US")
alpha3CodeISO 3166-1 Alpha-3-Code (z.B. "USA")
numericCodeISO 3166-1 numerischer Code (z.B. 840)
nativeNameEigenname des Landes
capitalHauptstadt
mainLanguagePrimärer Sprachcode
languagesListe der gesprochenen Sprachcodes
tldTop-Level-Domain (z.B. ".us")
callingCodeInternationale Vorwahl (z.B. 1)
continentKontinent-Bezeichner
currencyPrimärer Währungscode

Suche nach Code

Alpha-2-Code

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

Alpha-3-Code

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

Numerischer Code (nur Dart)

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

Alle Länder auflisten

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

Nach Kontinent filtern

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

SVG-Flaggen

Für jedes Land ist eine eingebettete SVG-Flagge als String verfügbar.

GoDartTypeScript
// Zugriff über die countryFlags-Map
final svg = countryFlags['US'];

// Oder über die Country-Eigenschaft
final country = Country.fromAlpha2Code('US');
final flagSvg = country?.flagSvg;

// Als Flutter-Widget rendern
country?.flag(
  shape: FlagShape.rectangle,
  width: 32,
  height: 24,
);

Emoji-Flaggen

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

Länder-Metadaten

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