redeemWith<C, D> method

Either<C, D> redeemWith<C, D>({
  1. required Either<C, D> leftOperation(
    1. L value
    ),
  2. required Either<C, D> rightOperation(
    1. R value
    ),
})

Redeem an Either to an Either by resolving the error or mapping the value R to C with an Either.

redeemWith is derived from flatMap and handleErrorWith. This is functionally equivalent to flatMap(rightOperation).handleErrorWith(leftOperation).

Implementation

Either<C, D> redeemWith<C, D>({
  required Either<C, D> Function(L value) leftOperation,
  required Either<C, D> Function(R value) rightOperation,
}) =>
    _foldInternal(
      ifLeft: leftOperation,
      ifRight: rightOperation,
    );