getIdFromName static method

String? getIdFromName(
  1. String name
)

Return the id of the emoji from its camel case name.

For example: 'smileWithBigEyes' => 1f603.

Throws a EmojiNotFoundException when no emoji with name exists.

See also:

Implementation

static String? getIdFromName(String name) {
  try {
    final emoji =
        AnimatedEmojis.values.firstWhere((element) => element.name == name);

    return emoji.id;
  } catch (e) {
    throw EmojiNotFoundException.fromName(name);
  }
}