clearSelection method

void clearSelection(
  1. ValueItem<T> option
)

clear specific selected option MultiSelectController is used to clear specific selected option.

Implementation

void clearSelection(ValueItem<T> option) {
  if (!value._selectedOptions.contains(option)) return;

  if (value._disabledOptions.contains(option)) {
    throw Exception('Cannot clear selection of a disabled option');
  }

  if (!value._options.contains(option)) {
    throw Exception(
        'Cannot clear selection of an option that is not in the options list');
  }

  value._selectedOptions.remove(option);
  notifyListeners();
}