complete method
Completes future with the supplied values.
The value must be either a value of type T
or a future of type Future<T>
.
If the value is omitted or null
, and T
is not nullable, the call
to complete
throws.
If the value is itself a future, the completer will wait for that future to complete, and complete with the same result, whether it is a success or an error.
Calling complete or completeError must be done at most once.
All listeners on the future are informed about the value.
Implementation
@override
void complete([FutureOr<T>? value]) {
assert(
_isStarted == true, "Completing a future that hasn't been started...");
if (!_delegate.isCompleted) _delegate.complete(value);
}