removeFirstWhere method

bool removeFirstWhere(
  1. bool test(
    1. T
    )
)

Removes the first element in the list that satisfies the given test. Returns true if an element was removed, otherwise false.

Implementation

bool removeFirstWhere(bool Function(T) test) {
  for (T element in this) {
    if (test(element)) {
      remove(element);
      return true;
    }
  }
  return false;
}