)
Complete future with an error.
Calling complete or completeError
must not be done more than once.
Completing a future with an error indicates that an exception was thrown while trying to produce a value.
If error
is null
, it is replaced by a NullThrownError.
If error
is a Future
, the future itself is used as the error value.
If you want to complete with the result of the future, you can use:
thisCompleter.complete(theFuture)
or if you only want to handle an error from the future:
theFuture.catchError(thisCompleter.completeError);
Source
/**
* Complete [future] with an error.
*
* Calling [complete] or `completeError` must not be done more than once.
*
* Completing a future with an error indicates that an exception was thrown
* while trying to produce a value.
*
* If [error] is `null`, it is replaced by a [NullThrownError].
*
* If `error` is a `Future`, the future itself is used as the error value.
* If you want to complete with the result of the future, you can use:
*
* thisCompleter.complete(theFuture)
*
* or if you only want to handle an error from the future:
*
* theFuture.catchError(thisCompleter.completeError);
*
*/
void completeError(Object error, [StackTrace stackTrace]);