locale_emoji 1.0.0
SDKdartflutter
Platformandroidioswindowslinuxmacosweb
Convert Locale (language code, script code and country code) to the corresponding Emoji Flag
🏳️ Locale Emoji 🏴
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
Localeextension (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-json.
In case of any updates in cldr-json, please, run the following command in the root of the repository and submit a PR.
dart tool/update_defaults.dart