FutureActionStatusExtension extension

Extension methods on Future<ActionStatus>, which is the type returned by Store.dispatchAndWait. They let you chain code that should run only if the action completed OK, or only if it failed, without having to await and check the status manually.

on

Methods

thenIfCompletedFailed(FutureOr<void> callback(ActionStatus status)) → Future<ActionStatus>

Available on Future<ActionStatus>, provided by the FutureActionStatusExtension extension

Runs the given callback only if the action failed, meaning ActionStatus.isCompletedFailed is true: the action finished, but its 'before' or 'reduce' methods threw an error, and the reducer could not return a value to change the state.
thenIfCompletedOk(FutureOr<void> callback(ActionStatus status)) → Future<ActionStatus>

Available on Future<ActionStatus>, provided by the FutureActionStatusExtension extension

Runs the given callback only if the action completed OK, meaning ActionStatus.isCompletedOk is true: the action finished, and its 'before' and 'reduce' methods did not throw any errors.