findIndexes method

List findIndexes(
  1. bool f(
    1. dynamic
    )
)

Find the indexes of all the elements for which f returns true. Leaves the stream positioned at the end.

Implementation

List<dynamic> findIndexes(bool Function(dynamic) f) {
  var results = [];
  while (!atEnd()) {
    if (f(next())) results.add(index - 1);
  }
  return results;
}