peek abstract method

GenericStream<T> peek(
  1. void action(
    1. T
    )
)

Returns a stream consisting of the elements of this stream, additionally performing the provided action on each element as elements are consumed from the resulting stream.

Example

final result = GenericStream.of([1, 2, 3])
    .peek((n) => print('Processing: $n'))
    .map((n) => n * 2)
    .toList();

Implementation

GenericStream<T> peek(void Function(T) action);