filter method

Iterable<T> filter(
  1. bool test(
    1. T element
    )
)

Returns a new Iterable with all elements that satisfy the predicate test.

Example:

[1, 2, 3, 4].filter((n) => n < 3).toList(); // [1,2]

This method is an alias for where.

Implementation

Iterable<T> filter(bool Function(T element) test) {
  ArgumentError.checkNotNull(test, 'test');
  return where(test);
}