wait method
Executes all queued operations and returns their results.
This triggers the invocation of all pending functions. It returns a
FutureOr<Iterable<T>> that completes with the results.
onError: A specific error handler for this call, which runs in addition to the waiter's default error handler.eagerError: Iftrue(the default), fails as soon as one operation fails, similar toFuture.wait— but secondary rejections are absorbed rather than being leaked to the surroundingZone(a deliberate divergence fromFuture.waitfor audit-trail cleanliness).
Both the ctor-level handler and the call-level handler are awaited if
they return a Future, and a throw inside one never prevents the other
from running — handler failures are surfaced through
Zone.current.handleUncaughtError instead, preserving the original
incident as the caller-facing error.
Implementation
FutureOr<Iterable<T>> wait({
_TOnErrorCallback? onError,
bool eagerError = true,
}) {
final ctorHandler = _onError;
final callHandler = onError;
final factories = _operations.map((op) => op.run);
if (ctorHandler == null && callHandler == null) {
return waitAlikeF(factories, eagerError: eagerError);
}
return waitAlikeF(
factories,
onError: (Object e, StackTrace? s) =>
_runHandlers(ctorHandler, callHandler, e, s),
eagerError: eagerError,
);
}