Closed danishrafiqe closed 6 months ago
The package doesn't offer a direct helper method for that but you should be able to just check your text with regex for words or letters. Or seems there is also a package called emoji_regex, not sure if it is helpful tho.
A bit complex, but it should be possible to create this regex and then check every character in your string
final regExBuffer = StringBuffer();
for (final list in defaultEmojiSet) {
for (final emoji in list.emoji) {
// Put emoji inclusive skin tone before actualy emoji
// to avoid color and emoji being seperated
if (emoji.hasSkinTone) {
for (final skinTone in SkinTone.values) {
regExBuffer.write(
'${utils.applySkinTone(emoji, skinTone).emoji}$delimiter',
);
}
}
regExBuffer.write('${emoji.emoji}$delimiter');
}
}
final regExString = regExBuffer.toString();
RegExp regex = RegExp(regExString.substring(0, regExString.length - 1));
How to match emoji in text Field Basically i want to check My Typed Message is only Emoji or with text