getIdFromName static method

String getIdFromName(
  1. String name
)

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

For example: 'smileWithBigEyes' => u1f603.

Throws a EmojiNotFoundException when no emoji with name exists.

See also:

Implementation

static String getIdFromName(String name) {
  final nameToIds = <String, String>{};
  _idToNames.forEach((key, value) {
    nameToIds[value] = key;
  });

  final id = nameToIds[name];

  if (id == null) {
    throw EmojiNotFoundException.fromName(name);
  }

  return id;
}