tap<A> function

Task<A> Function(Task<A> task) tap<A>(
  1. FutureOr<void> f(
    1. A value
    )
)

Perform a side effect on the value of a Task.

expect(
  await fromThunk(() => 'hi').chain(tap(print))(),
  equals('hi'),
);

Implementation

Task<A> Function(Task<A> task) tap<A>(FutureOr<void> Function(A value) f) =>
    flatMapFirst((a) => value(f(a)));