expect method

T expect(
  1. String msg
)

Returns the contained Ok value, consuming the this value.

Throw an error if the value is an Err, with an error message including the passed message, and the content of the Err.

Implementation

T expect(String msg) =>
    isOk ? _okValue : throw UnwrapError(msg, obj: _errValue);