getAllEmojiDefinitions function
Returns all possible EmojiDefinitions. Allows to cache results via cache
parameter.
If emojis are cached it will resolve immediately with result.
Implementation
Stream<EmojiDefinition> getAllEmojiDefinitions({bool cache = false}) async* {
if (_emojisCache.isNotEmpty) {
yield* Stream.fromIterable(_emojisCache);
}
final rawData = await _downloadEmojiData();
for (final emojiDefinition in rawData["emojiDefinitions"]) {
final definition = EmojiDefinition._new(emojiDefinition as RawApiMap);
if (cache) {
_emojisCache.add(definition);
}
yield definition;
}
}