requireValue property

T get requireValue

Force-retrieves the current value if the status is LxSuccess.

Throws the internal error if status is LxError, or a StateError if the status is LxIdle or LxWaiting.

Implementation

T get requireValue {
  final s = value;
  if (s is LxSuccess<T>) return s.value;
  if (s is LxError<T>) throw s.error;
  throw StateError('Async operation has no value yet (status: $s)');
}