toggleSelection method

void toggleSelection(
  1. T item
)

Toggles the selection of the specified item. In singleSelect mode, only one item can be selected at a time.

Implementation

void toggleSelection(T item) {
  if (type == SearchSheetType.singleSelect) {
    selectedItems = [item];
  } else {
    if (selectedItems.contains(item)) {
      selectedItems.remove(item);
    } else {
      selectedItems.add(item);
    }
  }
  notifyListeners();
}