where method Null safety
- bool f(
- E element
Returns a new lazy Iterable with all elements that satisfy the
The matching elements have the same order in the returned iterable as they have in iterator.
This method returns a view of the mapped elements.
As long as the returned Iterable is not iterated over,
the supplied function
test will not be invoked.
Iterating will not cache results, and thus iterating multiple times over
the returned Iterable may invoke the supplied
test multiple times on the same element.
final numbers = <int>[1, 2, 3, 5, 6, 7]; var result = numbers.where((x) => x < 5); // (1, 2, 3) result = numbers.where((x) => x > 5); // (6, 7) result = numbers.where((x) => x.isEven); // (2, 6)
Iterable<E> where(bool f(E element)) => WhereIterable<E>(this, f);