Search packages, repositories and app categories

Package detailsv1.2.0

country_code

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

AndroidiOSWebmacOSWindowsLinux
30-day downloads
57.4K
Likes
20
Pub points
160

Install package

flutter pub add country_code

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The country_code package provides a comprehensive, enum-like class containing ISO 3166-1 country codes, enabling easy access to standardized country identifiers. It supports parsing country codes from strings and allows user-defined code assignments. Ideal for applications requiring country selection, localization, or data validation based on country codes. The package is lightweight and compatible across all major platforms including Android, iOS, Web, macOS, Windows, and Linux.

Use cases

  • Country selection in forms
  • Localization and region-based content
  • User profile country input
  • Data validation using ISO codes
  • International phone number formatting

Key features

  • ISO 3166-1 country code enumeration
  • String parsing for country codes
  • Support for custom country code mappings
  • Cross-platform compatibility
  • Lightweight and easy to integrate

Suitable for

  • Mobile apps with international users
  • Web applications requiring country data
  • Form inputs needing country selection
  • Apps supporting multiple languages and regions

Considerations

  • Requires manual handling of non-standard country entries
  • Limited to ISO 3166-1 codes only
  • No built-in UI components for picker functionality

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

List of ISO 3166-1 assigned country codes.

pub package License

Features

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

Usage

import 'package:country_code/country_code.dart';

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

See more examples

Bugs and feature requests

Please file feature requests and bugs at the issue tracker.

Categories

Source repository

Projects using this package