Locale Emoji

pub package

Convert Locale (languageCode, scriptCode and countryCode) to the corresponding Emoji Flag. Inspired by https://github.com/10xjs/locale-emoji

Usage

import 'package:locale_emoji/locale_emoji.dart' as le;

//...

final flagDe = le.getFlagEmoji('de'); // πŸ‡©πŸ‡ͺ
final flagSk = le.getFlagEmoji('sk', scriptCode: 'Latin', countryCode: 'SK'); // πŸ‡ΈπŸ‡°

Flutter

For flutter, use locale_emoji_flutter package instead.

import 'package:locale_emoji_flutter/locale_emoji_flutter.dart';

//...

final Locale localeDe = Locale('de');
final flagDe = localeDe.flagEmoji; // πŸ‡©πŸ‡ͺ

final Locale localeSk = Locale.fromSubtags(
  languageCode: 'sk',
  scriptCode: 'Latin',
  countryCode: 'SK',
);
final flagSk = localeSk.flagEmoji; // πŸ‡ΈπŸ‡°

Additional information

Defaults might be updated in the origin: cldr-core. In case of any updates in cldr-core, please, run the following command in the root of the repository and submit a PR.

dart tools/update_defaults.dart

GitHub

View Github