isOnlyEmoji function

bool isOnlyEmoji(
  1. String text
)

Returns true if the given text contains only emojis and whitespace. Returns false if the text contains any non-emoji characters.

Implementation

bool isOnlyEmoji(String text) {
  if (text.isEmpty) return false;
  final trimmed = text.replaceAll(whitespaceRegex, '');
  if (trimmed.isEmpty) return false;
  return trimmed.replaceAll(emojiRegex, '').isEmpty;
}