mapError method

Result<V> mapError(
  1. dynamic transform(
    1. dynamic
    )
)

The given function is applied if this is a Error.

Example:

Result.value(12).mapLeft ( (v) => "flower" ) // Result: ValueResult(12)
Result.error(12).mapLeft ( (v) => "flower" )  // Result: ErrorResult("flower)

Implementation

$async.Result<V> mapError(dynamic Function(dynamic) transform) {
  if (isValue) {
    return $async.Result.value(asValue!.value);
  } else {
    return $async.Result.error(transform(asError!.error));
  }
}