detachItems method

Iterable<T> detachItems([
  1. bool predicate(
    1. T
    )?
])

Detach items from a list according to a function and return these items

Implementation

Iterable<T> detachItems([bool Function(T)? predicate]) {
  predicate = predicate ?? (x) => true;
  var items = where(predicate);
  removeWhere((e) => items.contains(e));
  return items;
}