combine<T> static method

OffsetIterator<T> combine<T>(
  1. Iterable<OffsetIterator<T>> iterators, {
  2. String name = 'OffsetIterator.combine',
  3. bool closeOnError = true,
  4. SeedCallback<T>? seed,
})

Combine multiple OffsetIterator's into one.

Implementation

static OffsetIterator<T> combine<T>(
  Iterable<OffsetIterator<T>> iterators, {
  String name = 'OffsetIterator.combine',
  bool closeOnError = true,
  SeedCallback<T>? seed,
}) {
  final c = OffsetIteratorController<T>(
    name: name,
    closeOnError: closeOnError,
    seed: seed,
  );

  Future.wait(iterators.map((i) => i.pipe(c, closeOnDrained: false)))
      .whenComplete(c.close);

  return c.iterator as OffsetIterator<T>;
}