iso_country 2.0.0
iso_country: ^2.0.0 copied to clipboard
Constants that contain detailed information about ISO countries as per ISO-3166-1.
iso_country 🌍 #
A package providing constants to access information about countries according to the ISO 3166 standard. There are classes for every country—plus a special built-in entry for the Republic of Kosovo. Compatible with Dart 3 and works across Android, iOS, Linux, macOS, Windows, Web, and Flutter.
Features #
- 🗺️ Compile-time classes for all ISO 3166 countries (
IsoCountry,IsoCountries). - 🇽🇰 Includes a custom
IsoCountryinstance for Kosovo. - Simple API: retrieve alpha‑2, alpha‑3, and numeric codes, plus country names.
- Minimal dependencies: relies only on country, and meta.
API Overview #
Use the iso_country library to access country information:
import 'package:iso_country/iso_country.dart';
void main() {
const usa = IsoCountries.US;
print(usa.alpha2); // "US"
print(usa.alpha3); // "USA"
print(usa.numeric); // "840"
const kosovo = IsoCountries.KO; // Kosovo instance
print(kosovo.alpha2); // "XK"
}
-
IsoCountries– accessor for all country constants. -
IsoCountry– class exposing:alpha2(String)alpha3(String)numeric(String)- And much more!
Explore the full API Docs on pub.dev.
Why choose iso_country? #
- ✅ Standard-compliant: based on official ISO 3166 country codes.
- 🛠️ Compile-time generation ensures no runtime overhead.
- 🇽🇰 Supports Kosovo (XK) out-of-the-box.
- 📦 Lightweight and dependency-minimal.
With iso_country, you get accurate, ready-to-use ISO country codes—ideal for form validations, APIs, localization, and more.
License #
Distributed under the GNU LGPL 2.1 license.