expect method

T expect(
  1. String msg
)

Returns the contained Some value, consuming the this value.

Throw an error if the value is a None with a custom error message provided by msg.

Implementation

T expect(String msg) => isSome ? _someValue : throw UnwrapError(msg);