*<Null safety>*
Iterable<List<T>> splitAfterIndexed (bool test(int index, T element))
Iterable<List<T>> splitAfterIndexed( bool Function(int index, T element) test) sync* { var index = 0; List<T>? chunk; for (var element in this) { (chunk ??= []).add(element); if (test(index++, element)) { yield chunk; chunk = null; } } if (chunk != null) yield chunk; }