ReactterActionCallable<T, P> class
abstract
A abstract class of ReactterAction that may be called using a call method.
Example:
class AddTodoAction extends ReactterActionCallable<Store, String> {
AddTodoAction(String payload)
: super(
type: 'todo/todoAdded',
payload: payload,
);
Store call(state) {
return state.copyWith(
todo: state.todo..add(payload),
);
}
}
Store _reducer(Store state, ReactterAction action) =>
action is ReactterActionCallable ? action(state) : UnimplementedError()
final state = UseReducer(_reducer, Store());
state.dispatch(AddTodoAction('Todo this'));
See also:
- ReactterAction, a representation of an event that describes something that happened in the application.
- UseReducer, a ReactterHook that manages state using
reducer
method.
- Inheritance
-
- Object
- ReactterAction<
P> - ReactterActionCallable
Constructors
- ReactterActionCallable({required String type, required P payload})
-
const
Properties
Methods
-
call(
T state) → T - This method is called when the action is dispatched and is responsible for updating the state based on the action's payload.
-
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.
inherited