Country Flags

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

A Flutter package to show an SVG image of the flag of a country.

The flag can be created from a country code or a language code.

You can find all the supported countries listed here.

You can find the list of supported languages at www.lingoes.net/en/translator/langcode.htm (not all the language codes in the list are supported).

Showcase

Installation

Just add country_flags to your pubspec.yml file

dependencies:
  country_flags: ^2.2.0

Usage

Create a flag from a country code

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: CountryFlag.fromCountryCode(
            'ES',
            height: 48,
            width: 62,
            borderRadius: 8,
          ),
        ),
      ),
    );
  }
}

Create a flag from a language code

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: CountryFlag.fromLanguageCode('en'),
        ),
      ),
    );
  }
}

Credits

Thanks to jovial_svg which is used to render the SVG images from binary files. And many thanks to bgoncharuck for doing the implementation.

Thanks to the project flag-icons for providing the required SVG flags.

Alternatives

Libraries

country_flags
A library to generate country flag widgets.