emojify method

String emojify(
  1. String text
)

Emojify the input text.

For example: 'I :heart: :coffee:' => 'I ❤️ ☕'

Implementation

String emojify(String text) {
  Iterable<Match> matches = REGEX_NAME.allMatches(text);
  if (matches.isNotEmpty) {
    String result = text;
    matches.toList().forEach((m) {
      var _e = EmojiUtil.stripColons(m.group(0)!);
      if (hasName(_e)) {
        result = result.replaceAll(m.group(0)!, get(_e).code);
      }
    });
    return result;
  }
  return text;
}