splitn method
Returns an iterator over subslices separated by elements that match pred, limited to returning at most n items. e.g. n == 1 will return the whole slice. The matched element is not contained in the subslices. The last element returned, if any, will contain the remainder of the slice.
Implementation
RIterator<Slice<T>> splitn(int n, bool Function(T) pred) {
assert(n > 0, "n must be positive");
if (n < 1) {
return RIterator(<Slice<T>>[].iterator);
}
return RIterator(_splitnHelper(n, pred).iterator);
}