unwrapErr method

  1. @override
  2. @useResult
E unwrapErr({
  1. String? msg,
})
override

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
E unwrapErr({String? msg}) => error;