mapFailure<T extends Object> abstract method

  1. @useResult
Result<S, T> mapFailure<T extends Object>(
  1. T function(
    1. F failure
    )
)

If this is a Failure, maps F to T, otherwise returns S untouched.

Success(1).mapFailure((v) => v.toString()); // Success(1)

Failure(2).mapFailure((v) => v.toString()); // Failure('2')

Implementation

@useResult Result<S, T> mapFailure<T extends Object>(T Function(F failure) function);