getAllEmojiDefinitions function

Future<Iterable<EmojiDefinition>> getAllEmojiDefinitions (
  1. {bool cache: false}
)

Returns all possible EmojiDefinitions. Allows to cache results via cache parameter.

Implementation

Future<Iterable<EmojiDefinition>> getAllEmojiDefinitions({bool cache = false}) async {
  if(_emojisCache.isNotEmpty) {
    return Future.value(_emojisCache);
  }

  final rawData = await _downloadEmojiData();

  final _emojis = [
    for(final ed in rawData["emojiDefinitions"])
      EmojiDefinition._new(ed as Map<String, dynamic>)
  ];

  if(cache) {
    _emojisCache = _emojis;
  }

  return _emojis;
}