disableWhere method
disables the items that satisfy the predicate.
The predicate parameter is a function that takes a DropdownItem and returns a boolean.
Implementation
void disableWhere(bool Function(DropdownItem<T> item) predicate) {
_items = _items
.map(
(element) => predicate(element) && !element.disabled ? element.copyWith(disabled: true) : element,
)
.toList();
notifyListeners();
_onSelectionChanged?.call(_selectedValues);
}