.claude/skills/asyncredux-actions-no-state-change/SKILL.md
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.
npx skillsauth add marcglasberg/async_redux asyncredux-actions-no-state-changeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
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
}
}
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);
}
}
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
}
}
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;
}
}
Trigger navigation as a side effect:
class GoToSettings extends ReduxAction<AppState> {
AppState? reduce() {
dispatch(NavigateAction.pushNamed('/settings'));
return null;
}
}
AppState? for sync, Future<AppState?> for asyncURLs from the documentation:
data-ai
Show loading states and handle action failures in widgets. Covers `isWaiting(ActionType)` for spinners, `isFailed(ActionType)` for error states, `exceptionFor(ActionType)` for error messages, and `clearExceptionFor()` to reset failure states.
data-ai
Use `waitCondition()` inside actions to pause execution until state meets criteria. Covers waiting for price thresholds, coordinating between actions, and implementing conditional workflows.
testing
Handle user-facing errors with UserException. Covers throwing UserException from actions, setting up UserExceptionDialog, customizing error dialogs with `onShowUserExceptionDialog`, and using UserExceptionAction for non-interrupting error display.
tools
Implement undo/redo functionality using state observers. Covers recording state history with stateObserver, creating a RecoverStateAction, implementing undo for the full state or partial state, and managing history limits.