removeIf method

void removeIf(
  1. ConditionTester<T> condition,
  2. T element
)

Removes an item from a list if a condition is met.

Parameters

  • condition: The condition to check
  • element: The element to remove

Implementation

void removeIf(ConditionTester<T> condition, T element) {
  for (var item in List<T>.from(this)) {
    if (condition(item)) {
      remove(element);
    }
  }
}