Landen
Landen
Het pakket bevat 248+ landen met volledige ISO 3166-1-metadata.
Landeigenschappen
Elk land heeft de volgende velden:
| Veld | Beschrijving |
|---|---|
alpha2Code | ISO 3166-1 alfa-2-code (bijv. "US") |
alpha3Code | ISO 3166-1 alfa-3-code (bijv. "USA") |
numericCode | ISO 3166-1 numerieke code (bijv. 840) |
nativeName | Oorspronkelijke landnaam |
capital | Hoofdstad |
mainLanguage | Primaire taalcode |
languages | Lijst van gesproken taalcodes |
tld | Topniveaudomein (bijv. ".us") |
callingCode | Internationaal landnummer (bijv. 1) |
continent | Continentidentificatie |
currency | Primaire valutacode |
Opzoeken op code
Alfa-2-code
final country = Country.fromAlpha2Code('US');
print(country?.nativeName); // United States
print(country?.capital); // Washington, D.C.Alfa-3-code
final country = Country.fromAlpha3Code('USA');
print(country?.alpha2Code); // USNumerieke code (alleen Dart)
final country = Country.fromNumericCode(840);
print(country?.nativeName); // United States
Alle landen weergeven
final allCountries = Country.values;
print(allCountries.length); // 253Filteren op continent
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.
// 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
final country = Country.fromAlpha2Code('US');
print(country?.emojiFlag);Landmetadata
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