country_code2 2.0.0 copy "country_code2: ^2.0.0" to clipboard
country_code2: ^2.0.0 copied to clipboard

Provides list of ISO 3166-1 country codes in enum-like class, as well as parsing and user-assigned code elements

List of ISO 3166-1 assigned country codes.

pub package License

Features #

  • ✅ ISO 3166-1 alpha-2. alpha-3, and numeric country codes in enum-like class
  • ✅ Parsing of country codes from string
  • ✅ Support for user-assigned code elements

Usage #

import 'package:country_code/country_code.dart';

var code = CountryCode.tryParse("US");
if (code == CountryCodes.us) {
  print(code.countryName);
  print(code.alpha2);
  print(code.alpha3);
  print(code.numeric);
}

/// Use one of the named country codes.
var code = CountryCodes.us;
print(code.countryName);
print(code.alpha2);
print(code.alpha3);
print(code.numeric);

/// Get a full list of Country Codes:
final allCodes = CountryCode.values;

Bugs and feature requests #

Please file feature requests and bugs at the issue tracker.

building #

The list of country codes are stored in a tool/country_codes.yaml.

You can regenerate the 'country_codes.dart' file by running:

dart tool/generate_country_codes.dart

Thanks #

This code is a fork of denixport/dart.country

0
likes
150
points
21
downloads

Publisher

unverified uploader

Weekly Downloads

Provides list of ISO 3166-1 country codes in enum-like class, as well as parsing and user-assigned code elements

Repository (GitHub)
View/report issues

Topics

#country-codes #iso-3166-1

Documentation

API reference

License

MIT (license)

Dependencies

meta

More

Packages that depend on country_code2