searchEmoji method
Future<List<Emoji> >
searchEmoji(
- String keyword,
- List<
CategoryEmoji> emojiSet, { - bool checkPlatformCompatibility = true,
Search for related emoticons based on keywords
Implementation
Future<List<Emoji>> searchEmoji(String keyword, List<CategoryEmoji> emojiSet,
{bool checkPlatformCompatibility = true}) async {
if (keyword.isEmpty) return [];
if (_allAvailableEmojiEntities.isEmpty) {
final emojiPickerInternalUtils = EmojiPickerInternalUtils();
final data = [...emojiSet]
..removeWhere((e) => e.category == Category.RECENT);
final availableCategoryEmoji = checkPlatformCompatibility
? await emojiPickerInternalUtils.filterUnsupported(data)
: data;
// Set all the emoji entities
for (var emojis in availableCategoryEmoji) {
_allAvailableEmojiEntities.addAll(emojis.emoji);
}
}
return _allAvailableEmojiEntities
.toSet()
.where(
(emoji) => emoji.name.toLowerCase().contains(keyword.toLowerCase()))
.toSet()
.toList();
}