abortDispatch method

bool abortDispatch()

If abortDispatch returns true, the action will NOT be dispatched: before, reduce and after will not be called, and the action will not be visible to the store observers.

Note: No observer will be called. It will be as if the action was never dispatched. The action status will be isDispatchAborted: true.

For example, this mixin prevents reentrant actions (you can only call the action if it's not already running):

/// This mixin prevents reentrant actions. You can only call the action if it's not already
/// running. Example: `class LoadInfo extends ReduxAction<AppState> with NonReentrant { ... }`
mixin NonReentrant implements ReduxAction<AppState> {
  bool abortDispatch() => isWaiting(runtimeType);
}

Using abortDispatch is only useful under rare circumstances, and you should only use it if you know what you are doing.

See also:

Implementation

bool abortDispatch() => false;