locale_emoji

Convert Locale (language code, script code and country code) to the corresponding Emoji Flag


Keywords
dart, dart-library, dart2, emoji, emojify, flutter, flutter-apps, flutter-package, flutter-packages, flutter-plugin, locale-emoji
License
MIT

Documentation

🏳️ Locale Emoji 🏴

pub package

Convert 🌍 Locale (language code, script code and country code) to the corresponding 🏳️ Emoji Flag 🏴.
Inspired from the JS locale-emoji package.

Features

  • πŸš€ Written in pure dart
  • 🎈 NO dependencies
  • πŸ“± Flutter package for Locale extension (locale_emoji_flutter)
  • ✨ Safe to use as much as it could be

Usage

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

//...

final flagDe = le.getFlagEmoji(countryCode: 'DE'); // πŸ‡©πŸ‡ͺ
final flagDe = le.getFlagEmoji(languageCode: 'de'); // πŸ‡©πŸ‡ͺ

final flagSk = le.getFlagEmoji(languageCode: 'sk'); // πŸ‡ΈπŸ‡°
final flagSk = le.getFlagEmoji(countryCode: 'SK'); // πŸ‡ΈπŸ‡°
final flagSk = le.getFlagEmoji(languageCode: '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 Locale localeSk = Locale.fromSubtags(
  languageCode: 'sk',
  scriptCode: 'Latin',
  countryCode: 'SK',
);

final flagDe = localeDe.flagEmoji; // πŸ‡©πŸ‡ͺ
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

Support

Buy Me A Coffee