onMatch method

  1. @override
bool onMatch(
  1. InlineParser parser,
  2. Match match
)
override

Processes match, adding nodes to parser and possibly advancing parser.

Returns whether the caller should advance parser by match[0].length.

Implementation

@override
bool onMatch(InlineParser parser, Match match) {
  var alias = match[1]!;
  var emoji = emojis[alias];
  if (emoji == null) {
    parser.advanceBy(1);
    return false;
  }
  parser.addNode(Text(emoji));

  return true;
}