Search packages, repositories and app categories

country_flags cover
Package detailsv4.1.2

country_flags

A Flutter package to show a flag icon from a ISO country code.

AndroidiOSmacOSWindowsLinux
30-day downloads
217K
Likes
177
Pub points
160

Install package

flutter pub add country_flags

Package Overview

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

The country_flags package is a Flutter utility that enables developers to easily display flag icons using ISO country codes. It provides a simple and efficient way to integrate country-specific flags into apps, enhancing user experience with visual context. The package supports multiple platforms including Android, iOS, macOS, Windows, and Linux, ensuring consistent rendering across devices. With minimal setup via the pub add command, it integrates seamlessly into existing Flutter projects. Ideal for applications involving internationalization, user location, or regional selection.

Use cases

  • Displaying user country in profiles
  • Showing regional availability in apps
  • Enhancing multilingual interfaces
  • Visualizing location data
  • Supporting country selection in forms
  • Integrating flags in travel or social apps

Key features

  • Simple ISO code input
  • Cross-platform compatibility
  • Lightweight and fast
  • Predefined flag assets
  • Easy integration with pubspec.yaml
  • Consistent icon styling

Suitable for

  • Internationalized apps
  • User profile features
  • Travel and mapping apps
  • Multilingual platforms
  • Location-based services
  • UIs requiring country visualization

Considerations

  • Requires valid ISO country codes
  • Limited to predefined flag set
  • No custom flag support
  • May increase app size slightly
  • Depends on external asset repository
  • Not suitable for non-country flags

Original README

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

Country Flags

Pub GitHub Workflow Status (with branch) Pull Requests are welcome codecov Null safety

A Flutter package for displaying the SVG image or the emoji of a country's flag.

The flag can be generated using:

View the complete list of supported countries here.

For a list of supported languages, visit www.lingoes.net/en/translator/langcode.htm (please note that not all language codes on the list are supported).

Showcase

Image flags

Image flags

Emoji flags

Emoji flags

Installation

Simply add country_flags to your pubspec.yaml file.

dependencies:
  country_flags: ^4.0.0

Usage

Create a flag using a country code.

fromCountryCode supports 2 and 3 letter country code

CountryFlag.fromCountryCode('ES');

or

CountryFlag.fromCountryCode('ESP');
Create a flag from a language code
CountryFlag.fromLanguageCode('en');
Create a flag from a Currency code
CountryFlag.fromCurrencyCode('USD');
Create a flag from a phone prefix
CountryFlag.fromPhonePrefix('+34');
Tweak the size of the flag
CountryFlag.fromLanguageCode(
  'en',
  theme: const ImageTheme(
    width: 120,
    height: 80,
  ),
);
Create a circular flag
CountryFlag.fromCountryCode(
  'ES',
  theme: const ImageTheme(
    shape: Circle(),
  ),
);
Create a rectangular flag with rounded corners
CountryFlag.fromCountryCode(
  'ES',
  theme: const ImageTheme(
    shape: RoundedRectangle(6),
  ),
);
Use the emoji theme
CountryFlag.fromCountryCode(
  'ES',
  theme: EmojiTheme(size: 60),
)

Credits

Special thanks to jovial_svg which is utilized to render the SVG images from binary files. Many thanks to bgoncharuck for the implementation.

Acknowledgments to the flag-icons project for providing the necessary SVG flags.

Alternatives

Categories

Dependencies

Dependency list 2 items

Source repository

Projects using this package

Rankings