filter<T> function Transforming data

List<T> filter<T>(
  1. Iterable<T> iterable,
  2. bool test(
    1. T
    )
)

Returns a new list containing the values from iterable, in order, for which the given test function returns true.

Equivalent to List.where, except that it returns a list instead of an iterable:

filter({0, 2, 3, 4}, (x) => x.isOdd); // [3]

Implementation

List<T> filter<T>(Iterable<T> iterable, bool Function(T) test) =>
    iterable.where(test).toList();