Emojis for Dart Unicode 15.0
+
One, yet powerful emojis String extension
'ποΈteππ»xtππΌteππ½xtππΎteππΏxt'.emojis.extract; // [π, ππ», ππΌ, ππ½, ππΎ, ππΏ]
'textπ teπxt πtext'.emojis.remove; // text text text
// to Slack shortcodes:
'πtextπ€¦πΎββοΈ'.emojis.get.slackShortcodes; // [:grinning:, :woman-facepalming::skin-tone-5:]
// from Discord shortcodes:
'text:woman_facepalming_tone4:text'.emojis.fromShortcodes(); // textπ€¦πΎββοΈtext
Import import 'package:emoji_extension/emoji_extension.dart';
and you've got 2 benefits:
- get
- groups
- subgroups
- groupsWithSubgroups
- shortcodePlatforms
- getOne()
- getOneOrNull()
- byGroup()
- bySubgroup()
- any
- only
- onlyOne
- count
- remove
- split
- extract
- get
- hasAny()
- hasEach()
- splitMapJoin()
- replace()
- replaceEach()
- toShortcodes()
- fromShortcodes()
Full Emojis()
repository with unicodes, names, groups, subgroups, shortcodes:
Emojis() // .get .groups .subgroups .groupsWithSubgroups .shortcodePlatforms and many more...
Emojis().get; /* [
Emoji(
value: π,
unicode: 1F600,
name: Grinning Face,
group: Smileys & Emotion,
subgroup: face-smiling,
shortcodes: [
Shortcode(
platform: Discord,
value: grinning
),
Shortcode(
platform: Github,
value: grinning
),
Shortcode(
platform: Slack,
value: grinning
),
Shortcode(
platform: Default,
value: grinning_face
),
Shortcode(
platform: CLDR,
value: grinning_face
)]
),
Emoji(
value: π,
unicode: 1F603,
name: Grinning face with big eyes,
group: Smileys & Emotion,
subgroup: face-smiling,
shortcodes: [...]
)
...
] */
Emojis().get.values; // [π, π, π, π, π, π
, π€£, π, π, π, π« , π, π, π, π₯°, π, ...]
Emojis().get.unicodes; // [1F600, 1F603, 1F604, 1F601, 1F606, 1F605, 1F923, 1F602, 1F642, ...]
Emojis().get.names; // [Grinning face, Grinning face with big eyes, ...]
// Default (emoji name in snake_case)
Emojis().get.shortcodes; // [:grinning_face:, :grinning_face_with_big_eyes:, ...]
// CLDR
Emojis().get.cldrShortcodes; // [:grinning_face:, :grinning_face_with_big_eyes:, ...]
// Discord
Emojis().get.discordShortcodes; // [:grinning:, :smiley:, :smile:, :grin:, :laughing:, ...]
// Github (no skin-tone shortcodes)
Emojis().get.githubShortcodes; // [:grinning:, :smiley:, :smile:, :grin:, :laughing:, ...]
// Slack
Emojis().get.slackShortcodes; // [:grinning:, :smiley:, :smile:, :grin:, :laughing:, ...]
Emojis().groups; // [Group.smileysAndEmotion, Group.peopleAndBody, Group.component, ...]
Emojis().groups.values; // [Smileys & Emotion, People & Body, Component, Animals & Nature, ...]
Emojis().subgroups; // [Subgroup.faceSmiling, Subgroup.faceAffection, Subgroup.faceTongue, ...]
Emojis().subgroups.values; // face-smiling, face-affection, face-tongue, face-hand, ...]
Emojis().groupsWithSubgroups; // {Group.smileysAndEmotion: [Subgroup.faceSmiling, ...], ...}
Emojis().groupsWithSubgroupsValues; // {Smileys & Emotion: [face-smiling, ...], ...}
Emojis().shortcodePlatforms; // [Default, CLDR, Discord, Github, Slack]
// By value
Emojis().getOne('π'); // or
// By unicode
Emojis().getOne('1F600'); // or
// By name (ignore-case)
Emojis().getOne('Grinning Face'); // or
Emojis().getOne('grinning face'); // or
// By shortcode (ignore-colons)
Emojis().getOne(':grinning:'); // or
Emojis().getOne('grinning'); // or
Emojis().getOne('grinning_face'); /* [Emoji(
value: π,
unicode: 1F600,
name: Grinning face,
group: Smileys & Emotion,
subgroup: face-smiling,
shortcodes: [
Shortcode(
platform: Discord,
value: grinning
),
Shortcode(
platform: Github,
value: grinning
),
Shortcode(
platform: Slack,
value: grinning
),
Shortcode(
platform: Default,
value: grinning_face
),
Shortcode(
platform: CLDR,
value: grinning_face
)]
)] */
Equivalent of getOne() with null safety:
Emojis().getOneOrNull('π')?.name; // Grinning face
Emojis().getOneOrNull('some broken value')?.name; // null
Emojis().byGroup(Group.smileysAndEmotion); // [Emoji(value: π, ...), Emoji(value: π, ...), ...]
//or use convenient getters:
Emojis().smileysAndEmotion; // [Emoji(value: π, ...), Emoji(value: π, ...), ...]
Emojis().bySubgroup(Subgroup.faceSmiling); // [Emoji(value: π, ...), Emoji(value: π, ...), ...]
//or use convenient getters:
Emojis().faceSmiling; // [Emoji(value: π, ...), Emoji(value: π, ...), ...]
Simple emojis
extension that you can use to manipulate emojis on any text:
'π text with emojis π'.emojis // .any .only .count .remove .get .extract and many more...
'πtextπ'.emojis.any; // true
'text'.emojis.any; // false
'π'.emojis.only; // true
'π π π'.emojis.only; // true
'text π π π text'.emojis.only; // false
'text'.emojis.only; // false
'π'.emojis.onlyOne; // true
'π π π'.emojis.onlyOne; // false
'text π π π text'.emojis.onlyOne; // false
'text'.emojis.onlyOne; // false
'text π π π text'.emojis.count; // 3
'textπ teπxt πtext'.emojis.remove; // text text text
'textπtext'.emojis.split; // [text, text]
'ποΈteππ»xtππΌteππ½xtππΎteππΏxt'.emojis.extract; // [π, ππ», ππΌ, ππ½, ππΎ, ππΏ]
'πtext'.emojis.get; /* [Emoji(
value: π,
unicode: 1F600,
name: Grinning Face,
group: Smileys & Emotion,
subgroup: face-smiling,
shortcodes: [
Shortcode(
platform: Discord,
value: grinning
),
Shortcode(
platform: Github,
value: grinning
),
Shortcode(
platform: Slack,
value: grinning
),
Shortcode(
platform: Default,
value: grinning_face
),
Shortcode(
platform: CLDR,
value: grinning_face
)]
)] */
'πtext'.emojis.get.unicodes; // [1F600]
'πtext'.emojis.get.names; // [Grinning Face]
// Default (emoji name in snake_case)
'πtextπ€¦πΎββοΈ'.emojis.get.shortcodes; // [:grinning_face:, :woman_facepalming_medium_dark_skin_tone:]
// CLDR
'πtextπ€¦πΎββοΈ'.emojis.get.cldrShortcodes; // [:grinning_face:, :woman_facepalming_tone4:]
// Discord
'πtextπ€¦πΎββοΈ'.emojis.get.discordShortcodes; // [:grinning:, :woman_facepalming_tone4:]
// Github (no skin-tone shortcodes)
'πtextπ€¦πΎββοΈ'.emojis.get.githubShortcodes; // [:grinning:]
// Slack
'πtextπ€¦πΎββοΈ'.emojis.get.slackShortcodes; // [:grinning:, :woman-facepalming::skin-tone-5:]
'πtext'.emojis.get.groups; // [Group.smileysAndEmotion]
'πtext'.emojis.get.groups.values; // [Smileys & Emotion]
'πtext'.emojis.get.subgroups; // [Subgroup.faceSmiling]
'πtext'.emojis.get.subgroups.values; // [face-smiling]
'ποΈtext'.emojis.hasAny(['π']); // true
'πtext'.emojis.hasAny(['π', 'π']); // true
'ποΈteππ»xtππΌteππ½xtππΎteππΏxt'.emojis.hasAny(['π']); // false
'ποΈtext'.emojis.hasEach(['π']); // true
'πtextπ'.emojis.hasEach(['π', 'π']); // true
'πtext'.emojis.hasEach(['π', 'π']); // false
'textπtext'.emojis.splitMapJoin( // TEXT_emoji_TEXT
onMatch: (_) => '_emoji_',
onNonMatch: (s) => s.toUpperCase(),
);
'πtextπ'.emojis.replace('_'); // _οΈtext_
'πtextππ»textπ'.emojis.replaceEach({'π': 'ABC', 'ππ»': '123'}); // ABCtext123textABC
// Default (emoji name in snake_case)
'πtextπ€¦πΎββοΈ'.emojis.toShortcodes(); // :grinning_face:text:woman_facepalming_medium_dark_skin_tone:
// CLDR
'πtextπ€¦πΎββοΈ'.emojis.toCLDRShortcodes(); // :grinning_face:text:woman_facepalming_tone4:
// Discord
'πtextπ€¦πΎββοΈ'.emojis.toDiscordShortcodes(); // :grinning:text:woman_facepalming_tone4:
// Github (no skin-tone shortcodes)
'πtextπ€¦πΎββοΈ'.emojis.toGithubShortcodes(); // :grinning:textπ€¦πΎββοΈ
// Slack
'πtextπ€¦πΎββοΈ'.emojis.toSlackShortcodes(); // :grinning:text:woman-facepalming::skin-tone-5:
// Default
'text:woman_facepalming_medium_dark_skin_tone:text'.emojis.fromShortcodes(); // textπ€¦πΎββοΈtext
// CLDR or Discord
'text:woman_facepalming_tone4:text'.emojis.fromShortcodes(); // textπ€¦πΎββοΈtext
// Slack
'text:woman-facepalming::skin-tone-5:text'.emojis.fromShortcodes(); // textπ€¦πΎββοΈtext