removeItem method

void removeItem(
  1. T item
)

Removes an item from the selection.

Implementation

void removeItem(T item) {
  bool removed = false;

  if (_keyExtractor != null) {
    final key = _keyExtractor!(item);
    if (_selectedKeys.remove(key)) {
      _pendingKeys.remove(key);
      removed = true;
    }
  }

  if (_selectedItems.remove(item)) {
    removed = true;
  }

  if (removed) {
    _notifySelectionChanged();
    notifyListeners();
  }
}