wait property

Future<T> get wait

Returns a Future that completes when the operation succeeds or fails.

Throws StateError if the future is currently LxIdle.

Implementation

Future<T> get wait {
  if (_activeFuture != null) return _activeFuture!;
  final s = status;
  if (s is LxSuccess<T>) return Future.value(s.value);
  if (s is LxError<T>) return Future.error(s.error, s.stackTrace);
  throw StateError('LxFuture is idle. Call restart() to begin execution.');
}