Agent skill
asyncredux-actions-no-state-change
Creates AsyncRedux (Flutter) actions that return null from reduce() to not change the state. Such actions can still do side effects, dispatch other actions, or do nothing.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/asyncredux-actions-no-state-change
SKILL.md
Actions That Don't Change State
In AsyncRedux, returning a new state from reducers is optional. When you don't need to
modify the application state, return null to keep the current state unchanged.
Basic Pattern
Return null from reduce() when no state modification is needed:
class MyAction extends ReduxAction<AppState> {
AppState? reduce() {
// Perform side effects here
return null; // State remains unchanged
}
}
Conditional State Updates
Only update state when certain conditions are met:
class GetAmount extends ReduxAction<AppState> {
Future<AppState?> reduce() async {
int amount = await getAmount();
if (amount == 0)
return null; // No change needed
else
return state.copy(counter: state.counter + amount);
}
}
Coordinating Other Actions
Actions that dispatch other actions but don't modify state directly:
class InitAction extends ReduxAction<AppState> {
AppState? reduce() {
dispatch(ReadDatabaseAction());
dispatch(StartTimersAction());
dispatch(TurnOnListenersAction());
return null; // This action doesn't change state itself
}
}
Triggering External Services
Call external services without modifying app state:
class SendNotification extends ReduxAction<AppState> {
final String message;
SendNotification(this.message);
Future<AppState?> reduce() async {
await notificationService.send(message);
return null;
}
}
Navigation Actions
Trigger navigation as a side effect:
class GoToSettings extends ReduxAction<AppState> {
AppState? reduce() {
dispatch(NavigateAction.pushNamed('/settings'));
return null;
}
}
Key Points
- Actions that do return a new state can also do side effects and dispatch other actions.
- Return type matters: Use
AppState?for sync,Future<AppState?>for async - Null means no change: The store keeps its current state
References
URLs from the documentation:
- https://asyncredux.com/flutter/basics/changing-state-is-optional
- https://asyncredux.com/flutter/basics/actions-and-reducers
- https://asyncredux.com/flutter/basics/sync-actions
- https://asyncredux.com/flutter/basics/async-actions
- https://asyncredux.com/flutter/advanced-actions/redux-action
- https://asyncredux.com/flutter/advanced-actions/before-and-after-the-reducer
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?