unwrap method

T unwrap()

Returns the contained Ok value, consuming the this value.

Because this function may throw an error, its use is generally discouraged. Instead, prefer to handle the Err case explicitly, or call unwrapOr or unwrapOrElse.

Implementation

T unwrap() => isOk
    ? _okValue
    : throw UnwrapError(
        'called `Result#unwrap` on an `Err` value',
        obj: _errValue,
      );