Skip to content

.emoji()

Passes when the string consists of emoji, including skin tones, keycaps, flags and joined sequences such as a family. Symbols that only have a text presentation, such as ★ or →, fail unless they are followed by the emoji variation selector U+FE0F.

StringValidator<O> emoji({String? message, MessageBuilder? messageBuilder})
Parameter Type Meaning
message String? Replaces the default error message.
messageBuilder MessageBuilder? Builds the message from the issue. message wins when both are given. See Message builders.

Code invalidEmoji. Default message: value must be a valid emoji. value is replaced by the field name when there is one.

@IsEmoji(), or the constant @isEmoji. Put the annotation on the constructor parameter or the field.

final reaction = l.string().emoji();
reaction.validate(input)+2-2
  1. valid: '🎉'
  2. valid: '👨‍👩‍👧'
  3. invalid: '→'value must be a valid emoji
  4. invalid: 'a'value must be a valid emoji