partition library
Adds predicate partitioning support for iterables.
Functions
-
partition<
T> (Iterable< T> source, bool predicate(T), {bool lazy = true}) → List<Iterable< T> > -
Split a single iterable into two iterables based on the given predicate.
When
lazy
is false: partitioning is performed eagerly, the source iterable is iterated over once, and two Lists are returned. Whenlazy
is true: then two lazy iterables are returned, each of which will iterate over the source iterable.