selectWhere method

void selectWhere(
  1. bool predicate(
    1. DropdownItem<T> item
    )
)

selects the items that satisfy the predicate.

The predicate parameter is a function that takes a DropdownItem and returns a boolean.

Implementation

void selectWhere(bool Function(DropdownItem<T> item) predicate) {
  _items.where(predicate).forEach((element) {
    _selected.add(element);
    element.selected = true;
  });

  notifyListeners();
  _onSelectionChanged?.call(_selectedValues);
}