onEach<T> method Null safety

Future<void> onEach<T>(
  1. Stream<T> stream,
  2. void onData(
    1. T
    )
)

Subscribes to the provided stream and invokes the onData callback when the stream emits new data.

onEach completes when the event handler is cancelled or when the provided stream has ended.

Implementation

Future<void> onEach<T>(Stream<T> stream, void Function(T) onData);