removeLastWhere method

List<T> removeLastWhere(
  1. bool predicate(
    1. T
    ), [
  2. int count = 1
])

Remove the last count items of a list thats satisfy the predicate

Implementation

List<T> removeLastWhere(bool Function(T) predicate, [int count = 1]) {
  if (count > 0) {
    int c = 0;
    for (int i = length - 1; i >= 0; i--) {
      if (predicate(this[i])) {
        if (c >= count) break;
        removeAt(i);
        c++;
      }
    }
  }
  return this;
}