.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.
Signature
Section titled “Signature”StringValidator<O> emoji({String? message, MessageBuilder? messageBuilder})Parameters
Section titled “Parameters”| 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.
Code generation
Section titled “Code generation”@IsEmoji(), or the constant @isEmoji. Put the annotation on the constructor parameter or the field.
Example
Section titled “Example”final reaction = l.string().emoji();@IsEmoji() required String reaction, // l.string().emoji().required()reaction.validate(input)+2-2- valid:
'🎉' - valid:
'👨👩👧' - invalid:
'→' - invalid:
'a'