onFuture<T, S, O> function

Stream<S> Function(Stream<T> stream, OnDataTransform<T, S> , OnDataTransform<S, S> ) onFuture <T, S, O>(Future<O> onFuture())

Higher order function implementation for _OnStreamSampler which matches the method signature of buffer and window.

Each item is a sequence containing the items from the source sequence, batched whenever onFuture completes.


Stream<S> Function(
  Stream<T> stream,
  OnDataTransform<T, S>,
  OnDataTransform<S, S>,
) onFuture<T, S, O>(Future<O> onFuture()) {
  return (
    Stream<T> stream,
    OnDataTransform<T, S> bufferHandler,
    OnDataTransform<S, S> scheduleHandler,
  ) {
    if (onFuture == null) {
      throw new ArgumentError('onFuture cannot be null');

    return new _OnStreamSampler<T, S, O>(