whereIndexedTo method

void whereIndexedTo(
  1. List<E> destination,
  2. bool predicate(
    1. E element,
    2. int index
    )
)

Appends all elements matching the given predicate to the given destination.

Implementation

void whereIndexedTo(
    List<E> destination, bool Function(E element, int index) predicate) {
  var index = 0;
  for (var element in this) {
    if (predicate(element, index++)) {
      destination.add(element);
    }
  }
}