unEmojiFy method
This method will unemojify the text containing the Unicode emoji symbols into emoji name.
For example: 'I ❤️ Flutter' => 'I :heart: Flutter'
Implementation
String unEmojiFy(String text) {
Iterable<Match> matches = regexEmoji.allMatches(text);
if (matches.isNotEmpty) {
String result = text;
matches.toList().forEach((m) {
var group = m.group(0) ?? "";
if (hasEmoji(group)) {
result = result.replaceAll(group, getEmoji(group).full);
/// Just a quick hack to clear graphical byte from emoji.
/// TODO: find better way to get through this tweak
result = result.replaceAll(EmojiConst.charNonSpacingMark, EmojiConst.charEmpty);
}
});
return result;
}
return text;
}