unwrapErr abstract method

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

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

@useResult
E unwrapErr({String? msg});