country_flags 3.0.0 copy "country_flags: ^3.0.0" to clipboard
country_flags: ^3.0.0 copied to clipboard

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

Country Flags #

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

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

The flag can be generated using either a country code or a language code.

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

country_flag_shapes

Installation #

Simply add country_flags to your pubspec.yaml file.

dependencies:
  country_flags: ^3.0.0

Usage #

Create a flag using a country code. #

CountryFlag.fromCountryCode('ES');

Create a flag from a language code #

CountryFlag.fromLanguageCode('en');

Tweak the size of the flag #

CountryFlag.fromLanguageCode(
  'en',
  width: 120,
  height: 80,
);

Create a circular flag #

CountryFlag.fromCountryCode(
  'ES',
  shape: const Circle(),
);

Create a rectangular flag with rounded corners #

CountryFlag.fromCountryCode(
  'ES',
  shape: const RoundedRectangle(6),
);

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 #

87
likes
160
pub points
98%
popularity

Publisher

verified publisherfluttered.io

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

collection, flutter, jovial_svg

More

Packages that depend on country_flags