transitionSeoActionFlow function
Computes the next linear action-flow state without retaining state.
Implementation
SeoActionFlowState transitionSeoActionFlow(
SeoActionFlowState state,
SeoActionFlowAction action,
) {
final count = state.count < 0 ? 0 : state.count;
if (count == 0) return const SeoActionFlowState(index: 0, count: 0);
final current = state.index.clamp(0, count - 1);
final next = switch (action) {
SeoActionFlowNext() => (current + 1).clamp(0, count - 1),
SeoActionFlowPrevious() => (current - 1).clamp(0, count - 1),
};
return SeoActionFlowState(index: next, count: count);
}