Fintasys / emoji_picker_flutter

A Flutter package that provides an Emoji picker widget with 1500+ emojis in 8 categories.
MIT License
155 stars 114 forks source link

How can I get unify code from emoji? #57

Closed ghost closed 2 years ago

ghost commented 2 years ago

How can I get unify code from emoji? I click 'grinning face', its unified code is 1F600. How can I get that value from emoji picker? https://unicode.org/emoji/charts-13.0/full-emoji-list.html

Thank you very much

Fintasys commented 2 years ago

A emoji consists of runes. Simple emoji's like 'grinning face' only have 1 rune, if you add gender, skin-color etc they will have multiple runes. 1F600 is Hex which is nothing else like a number. So in dart the runes are from type Integer and you can easily format them to hex.

EmojiPicker(
      onEmojiSelected: (Category category, Emoji emoji) {
           emoji.emoji.runes.forEach((element) {
                print(element.toRadixString(16)); // 1F600
            });
      }
      ...
)

I hope that helps you !

ghost commented 2 years ago

Thank you very much @Fintasys . It is working Thank you very much 🙏