WaitAction<St> class

For this to work your store state must have a Wait field named wait, and then:

  1. The state must have a copy or copyWith method that copies this field as a named parameter. For example:
class AppState {
  final Wait wait;
  AppState({this.wait});
  AppState copy({Wait wait}) => AppState(wait: wait);
  }

OR:

  1. You must use the BuiltValue package https://pub.dev/packages/built_value, which automatically creates a rebuild method.

OR:

  1. You must use the Freezed package https://pub.dev/packages/freezed, which automatically creates the copyWith method.

OR:

  1. Inject your own WaitReducer implementation into WaitAction by replacing the static variable WaitAction.reducer with a callback that changes the wait object as you see fit.

OR:

  1. Don't use the WaitAction, but instead create your own MyWaitAction that uses the Wait object in whatever way you want.
Inheritance

Constructors

WaitAction.add(Object flag, {Object ref})
flag and ref must be immutable objects.
WaitAction.clear([Object flag])
WaitAction.remove(Object flag, {Object ref})

Properties

dispatch Dispatch<St>
read-only, inherited
dispatchFuture DispatchFuture<St>
read-only, inherited
flag Object
final
hasFinished bool
Returns true only if the action finished with no errors. In other words, if the methods before, reduce and after all finished executing without throwing any errors.
read-only, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
operation WaitOperation
final
ref Object
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
state → St
read-only, inherited
stateTimestamp DateTime
read-only, inherited
status ActionStatus
read-only, inherited
store Store<St>
read-only, inherited

Methods

abortDispatch() bool
If this 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 StoreTester. This is only useful under rare circumstances, and you should only use it if you know what you are doing.
inherited
after() → void
This is an optional method that may be overridden to run during action dispatching, after reduce. If this method throws an error, the error will be swallowed (will not throw). So you should only run code that can't throw errors. It may be synchronous only. Note this method will always be called, even if errors were thrown by before or reduce.
inherited
before() FutureOr<void>
This is an optional method that may be overridden to run during action dispatching, before reduce. If this method throws an error, the reduce method will NOT run, but the method after will. It may be synchronous (returning void) ou async (returning Future<void>).
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
reduce() → St
The reduce method is the action reducer. It may read the action state, the store state, and then return a new state (or null if no state change is necessary). [...]
override
reduceWithState(Store<St> store, St state) FutureOr<St>
Nest state reducers without dispatching another action. Example: return AddTaskAction(demoTask).reduceWithState(state); Don't use this! This is deprecated and will be removed soon, because it's more difficult to use than it seems. Unless you completely understand what you're doing, you should only used it with sync reducers.
inherited
setStore(Store<St> store) → void
inherited
toString() String
Returns a string representation of this object.
inherited
wrapError(dynamic error) Object
If any error is thrown by reduce or before, you have the chance to further process it by using wrapError. Usually this is used to wrap the error inside of another that better describes the failed action. For example, if some action converts a String into a number, then instead of throwing a FormatException you could do: wrapError(error) => UserException("Please enter a valid number.", error: error)
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited

Static Properties

reducer WaitReducer
Works out-of-the-box for most use cases, but you can inject your own reducer here during your app's initialization, if necessary.
read / write