BloomReducerFn<S, A> typedef
BloomReducerFn<S, A> =
S Function(S state, A action)
A pure state-transition function that computes the next state from the current state and an action.
Must be deterministic and free of side effects. Given the current state of type S
and an incoming action of type A, it returns a new state of type S.
Used by BloomReducer and useReducer to coordinate complex state machines.
sealed class CounterAction {}
class Increment extends CounterAction { final int amount; Increment(this.amount); }
class Reset extends CounterAction {}
int counterReducer(int state, CounterAction action) => switch (action) {
Increment(:final amount) => state + amount,
Reset() => 0,
};
Implementation
typedef BloomReducerFn<S, A> = S Function(S state, A action);