Flags

Flags

The package includes 256 SVG country flags, minified and embedded as strings. Flags are keyed by ISO 3166-1 alpha-2 country codes.

SVG Flags

Get a Flag by Country Code

GoDartTypeScriptphp
// Via the global map
final svg = countryFlags['US'];

// Via a Country instance
final country = Country.fromAlpha2Code('US');
final flagSvg = country?.flagSvg;

Rendering SVG Flags

The SVG strings can be used directly in your application:

GoDartTypeScriptphp
// Render as a Flutter widget with the built-in flag helper
final country = Country.fromAlpha2Code('NO');
country?.flag(
  shape: FlagShape.rectangle,
  width: 32,
  height: 24,
);

// Or use the raw SVG string
final svg = countryFlags['NO'];

Emoji Flags

Emoji flags are generated from country codes using regional indicator symbols.

GoDartTypeScriptphp
final country = Country.fromAlpha2Code('US');
print(country?.emojiFlag);

// Or directly from an enum
print(Country.norway.emojiFlag);

Language Flags

Languages can have a representative flag via their defaultFlagCode.

GoDartTypeScriptphp
final lang = Language.fromCode('fr');
final svg = lang?.flagSvg; // Resolves via defaultFlagCode

All Available Flags

Iterate over all available flags:

GoDartTypeScriptphp
countryFlags.forEach((code, svg) {
  print('$code: ${svg.length} bytes');
});