error property

E get error

Returns the error value.

Throws a StateError if this object contains a value instead of an error.

Implementation

E get error {
  if (_hasValue) {
    throw StateError('Cannot get error from an Expected containing a value: $_value');
  }
  return _error as E;
}