locale_emoji 1.0.0 locale_emoji: ^1.0.0 copied to clipboard
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
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-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