unwrapOrElse method

T unwrapOrElse(
  1. T elseFunc(
    1. Error? e
    )
)

Returns result.val if result is Ok. Returns call of elseFunc(result.err) if result is Err.

Implementation

T unwrapOrElse(T Function(Error? e) elseFunc) {
  if (isErr) {
    return elseFunc(err);
  }
  return val!;
}