locale_emoji 1.0.0 copy "locale_emoji: ^1.0.0" to clipboard
locale_emoji: ^1.0.0 copied to clipboard

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

🏳️ 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-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

Support #

Buy Me A Coffee

3
likes
160
points
249
downloads

Publisher

verified publishermichaeldark.dev

Weekly Downloads

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on locale_emoji