future property
Future<T>
future
If data or error is available, it will be returned directly (as Future.value / Future.error), otherwise a Completer will be used to await data or error.
Implementation
Future<T> get future {
if (isData) {
return Future.value(data);
} else if (isError) {
return Future.error((value as Error).error, (value as Error).stackTrace);
} else {
return _addCompleter(Completer<T>()).future;
}
}
Sets the value to Data result, containing the data returned by the provided Future.
See also:
- setDataAsync which is used to set the new value.
Implementation
set future(Future<T> future) {
setDataAsync(() => future).ignore();
}