filter method

Iterable<T> filter(
  1. bool predicate(
    1. T t
    )
)

Returns the list of those elements that satisfy predicate.

Implementation

Iterable<T> filter(bool Function(T t) predicate) =>
    foldLeft([], (a, e) => predicate(e) ? [...a, e] : a);