retainWhere method

void retainWhere (
  1. bool test(
    1. V element
    )
)
override

See Set.retainWhere

Implementation

void retainWhere(bool test(V element)) {
  List<V> chosen = [];
  for (var target in this) {
    if (test(target)) {
      chosen.add(target);
    }
  }
  clear();
  addAll(chosen);
}