waitAllActions method

Future<void> waitAllActions(
  1. List<ReduxAction<St>> actions, {
  2. bool completeImmediately = false,
})

Returns a future that completes when ALL given actions finished dispatching. You MUST provide at list one action, or an error will be thrown.

If completeImmediately is false (the default), this method will throw StoreException if none of the given actions are in progress when the method is called. Otherwise, the future will complete immediately and throw no error.

Example:

// Dispatching two actions in PARALLEL and waiting for both to finish.
var action1 = ChangeNameAction('Bill');
var action2 = ChangeAgeAction(42);
await waitAllActions([action1, action2]);

// Compare this to dispatching the actions in SERIES:
await dispatchAndWait(action1);
await dispatchAndWait(action2);

Implementation

Future<void> waitAllActions(List<ReduxAction<St>> actions, {bool completeImmediately = false}) {
  if (actions.isEmpty) throw StoreException('You have to provide a non-empty list of actions.');
  return _store.waitAllActions(actions, completeImmediately: completeImmediately);
}