Convert π Locale (language code, script code and country code) to the corresponding π³οΈ Emoji Flag π΄.
Inspired from the JS locale-emoji package.
- π Written in pure dart
- π NO dependencies
- π± Flutter package for
Locale
extension (locale_emoji_flutter) - β¨ Safe to use as much as it could be
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'); // πΈπ°
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; // πΈπ°
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