mapErr<F> abstract method

  1. @useResult
Result<T, F> mapErr<F>(
  1. F map(
    1. E error
    )
)

Transforms the contained error, if any, by applying map to it.

Examples

// prints "Ok(2)"
print(const Ok<int, String>(2).mapErr((error) => '$error!'));

// prints "Err(error!)"
print(const Err<int, String>('error').mapErr((error) => '$error!'));

Implementation

@useResult
Result<T, F> mapErr<F>(F Function(E error) map);