stream<T> method

void stream<T>(
  1. Stream<T> stream, [
  2. void listen(
    1. T next
    )?
])

Implementation

void stream<T>(Stream<T> stream, [void listen(T next)?]) {
  subscriptions.add(stream.listen(
    (val) {
      if (!_isDisposing) {
        listen?.call(val);
      }
    },
    cancelOnError: false,
    onError: (error, stack) {
      log.info(error);
      log.info(stack);
    },
  ));
}