unwrapErr method
Returns the contained error.
Throws
Throws a StateError (with custom message msg
if provided) if this
is an Err.
Examples
// throws a `StateError`
print(const Ok<int, String>(2).unwrapErr());
// prints "error"
print(const Err<int, String>('error').unwrapErr());
Implementation
@override
@useResult
Never unwrapErr({String? msg}) {
throw StateError('${msg ?? 'tried to unwrap `Ok` as `Err`'}: $value');
}