mapFailure<T extends Object> method

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

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

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