AbortDispatchException class

If an action throws an AbortDispatchException the action will abort immediately (But note the after method will still be called no mather what). The action status will be isDispatchAborted: true.

You can use it in the before method to abort the action before the reduce method is called. That's similar to throwing an UserException, but without showing any errors to the user.

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);
}

See also:

Implemented types

Constructors

AbortDispatchException()

Properties

hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
override