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:
| Feld | Beschreibung |
|---|---|
alpha2Code | ISO 3166-1 Alpha-2-Code (z.B. "US") |
alpha3Code | ISO 3166-1 Alpha-3-Code (z.B. "USA") |
numericCode | ISO 3166-1 numerischer Code (z.B. 840) |
nativeName | Eigenname des Landes |
capital | Hauptstadt |
mainLanguage | Primärer Sprachcode |
languages | Liste der gesprochenen Sprachcodes |
tld | Top-Level-Domain (z.B. ".us") |
callingCode | Internationale Vorwahl (z.B. 1) |
continent | Kontinent-Bezeichner |
currency | Primärer Währungscode |
Suche nach 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); // USNumerischer Code (nur Dart)
final country = Country.fromNumericCode(840);
print(country?.nativeName); // United States
Alle Länder auflisten
final allCountries = Country.values;
print(allCountries.length); // 253Nach Kontinent filtern
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.
// 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
final country = Country.fromAlpha2Code('US');
print(country?.emojiFlag);Länder-Metadaten
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