splitBefore method
Splits the elements into chunks before some elements.
Each element except the first is checked using test
for whether it should be the first element in a new chunk.
If so, the elements since the previous chunk-starting element
are emitted as a list.
Any remaining elements are emitted at the end.
Example: Example:
var parts = [1, 0, 2, 1, 5, 7, 6, 8, 9].splitBefore(isPrime);
print(parts); // ([1, 0], [2, 1], [5], [7, 6, 8, 9])
Implementation
Iterable<List<T>> splitBefore(bool Function(T element) test) =>
splitBeforeIndexed((_, element) => test(element));