search<K extends Object> method
Search the loaded items that match the given query, and set the matched items to the dropdown menu. It would be marked as a history without modifying the original items.
Implementation
void search<K extends Object>(
K query, {
required DropdownItemMatcher<K, T> matcher,
}) {
if (_currentHistory?.key == query) {
return;
}
final old = _removeHistory(query);
if (old != null) {
_addHistory(query, old.items);
} else {
final matchedItems =
_itemValues.where((item) => matcher(query, item)).toList();
_addHistory(query, matchedItems);
}
rebuildMenu();
}