mapOk method

  1. @override
Result<T> mapOk(
  1. @noFutures Ok<T> noFutures(
    1. Ok<T> ok
    )
)
override

Absorbs any throw from the callback into an Err. Widened from Ok<T> to Result<T> to make room for the absorbed error.

Implementation

@override
@pragma('vm:prefer-inline')
Result<T> mapOk(@noFutures Ok<T> Function(Ok<T> ok) noFutures) {
  try {
    return noFutures(this);
  } on Err catch (err) {
    return err.transfErr<T>();
  } catch (error, stackTrace) {
    return Err<T>(error, stackTrace: stackTrace);
  }
}