Action<TState> class
abstract
An action is a portion of logic that will alterate the current state of the application.
The middleware executes each action it receives by calling call and will propagate each new resulting state to the application context. If the execution failed, then it will call failed method to produce specific states.
See also :
ApplicationActionExecutor<TState>
which is the middleware that process actions.ApplicationContext<TState>
which is the root context used by an action.
- Inheritance
- Implementers
Constructors
- Action()
-
Creates a new action.
const
-
Action.function(String id, ApplicationFunctionCall<
TState> call, {ApplicationFunctionCanExecute<TState> ? canExecute, ApplicationFunctionFailed<TState> ? failed}) -
Creates a new action from a
call
function.constfactory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
call(
Context< TState> context) → Stream<Updater< TState> > -
An action execution will update the
context
's state by producing a stream of updates. -
canExecute(
TState state) → bool - Allows to block execution if the state isn't valid.
-
failed(
Context< TState> context, TState initialState, dynamic error, StackTrace stackTrace) → Stream<Updater< TState> > -
If the execution failed because of the given
error
andstackTrace
, then this method is invoked with theinitialState
, which is a snapshot of the application state before the execution of the action. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
throwNotExecutable(
) → dynamic -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
defaultCanExecute<
TState> (TState state) → bool -
defaultFailed<
TState> (Context< TState> context, TState initialState, dynamic error, StackTrace stackTrace) → Stream<Updater< TState> >