peek abstract method

IntStream peek(
  1. void action(
    1. int
    )
)

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

Example

final result = IntStream.range(1, 5)
    .peek((n) => print('Processing: $n'))
    .map((n) => n * 2)
    .toList();

Implementation

IntStream peek(void Function(int) action);