selectItem method

void selectItem(
  1. T item
)

Selects an item from the search results. This will store the selected item, hide the overlay, call the onItemSelected callback, and optionally clear the search.

Implementation

void selectItem(T item) {
  _selectedItem = item;
  _pendingKey = null;

  // Extract and store the key if keyExtractor is provided
  if (_keyExtractor != null) {
    _selectedKey = _keyExtractor!(item);
    _onKeySelected?.call(_selectedKey as K);
  }

  _onItemSelected?.call(item);
  hideOverlay();
  unfocus();
  notifyListeners();
}