doOnLeft method

Either<L, R> doOnLeft(
  1. void block(
    1. L v
    )
)

Performs a side-effect by running block function if the value is left and returns the same Either.

Can be useful for some logging, e.g.:

final either = someEither.doOnLeft(print);

Implementation

Either<L, R> doOnLeft(void Function(L v) block) => mapLeft((v) {
      block(v);

      return v;
    });