splitBetween method Null safety

Iterable<List<T>> splitBetween(
  1. bool test(
    1. T first,
    2. T second
    )
)

Splits the elements into chunks between some elements.

Each pair of adjacent elements are checked using test for whether a chunk should end between them. If so, the elements since the previous chunk-splitting elements are emitted as a list. Any final elements are emitted at the end.

Example:

var parts = [1, 0, 2, 1, 5, 7, 6, 8, 9].splitBetween((v1, v2) => v1 > v2);
print(parts); // ([1], [0, 2], [1, 5, 7], [6, 8, 9])

Implementation

Iterable<List<T>> splitBetween(bool Function(T first, T second) test) =>
    splitBetweenIndexed((_, first, second) => test(first, second));