partition<T> function

List<Iterable<T>> partition<T>(
  1. Iterable<T> source,
  2. bool predicate(
    1. T
    ), {
  3. bool lazy = true,
})

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. When lazy is true: then two lazy iterables are returned, each of which will iterate over the source iterable.

Implementation

List<Iterable<T>> partition<T>(
  Iterable<T> source,
  bool Function(T) predicate, {
  bool lazy = true,
}) =>
    source.partition(predicate, lazy: lazy);