wait property
Future<T>
get
wait
Returns a Future that completes when the operation reaches a terminal state.
If the current state is LxSuccess or LxError, the Future completes immediately. Otherwise, it waits for the next transition to a terminal state.
Implementation
Future<T> get wait async {
final s = value;
if (s is LxSuccess<T>) return Future.value(s.value);
if (s is LxError<T>) return Future.error(s.error, s.stackTrace);
var first = await stream.first;
if (first is LxSuccess<T>) return first.value;
if (first is LxError<T>) throw first.error;
throw StateError('Async operation has no value yet (status: $first)');
}