call method

Stream<Lifecycle<T>> call(
  1. StreamElement<Lifecycle<T>> value,
  2. Map<StreamNode, Stream> streams
)

Implementation

Stream<Lifecycle<T>> call(
    StreamElement<Lifecycle<T>> value, Map<StreamNode, Stream> streams) {
  final endStream = stopWhen.key.call(streams);
  return Schedule.emission<Lifecycle<T>>(
          duration: duration, after: after, emit: Lifecycle.start(emitElem))
      .call(value)
      .asyncExpand((v) => Stream.value(v).concatWith([
            Stream.fromFuture(stopWhen
                .value(endStream)
                .then((_) => Lifecycle.stop(emitElem)))
          ]));
}