hasOnlyEmojis static method
Returns true if the given text contains only emojis.
"👋" -> true
"👋 Hello" -> false
":wave:" --> false
"👋👋" -> true
"👋 👋" -> false (if ignoreWhitespace
is true, result is true)
Implementation
static bool hasOnlyEmojis(String text, {bool ignoreWhitespace = false}) {
if (ignoreWhitespace) text = text.replaceAll(' ', '');
for (final c in Characters(text))
if (!REGEX_EMOJI.hasMatch(c)) return false;
return true;
}