locale_emoji 0.2.1 icon indicating copy to clipboard operation
locale_emoji: ^0.2.1 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-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

2
likes
140
pub points
54%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

More

Packages that depend on locale_emoji