yx_state_transformers 1.0.0
yx_state_transformers: ^1.0.0 copied to clipboard
Custom task transformers for yx_state
yx_state_transformers #
Custom task transformers for yx_state.
Concurrency Strategies #
yx_state_transformers provides several concurrency strategies for handling tasks:
- Sequential - Process tasks one after another in order:
class CounterManager extends StateManager<CounterState> {
CounterManager()
: super(
const CounterState(0),
handler: sequential(),
);
}
- Concurrent - Process tasks in parallel:
class CounterManager extends StateManager<CounterState> {
CounterManager()
: super(
const CounterState(0),
handler: concurrent(),
);
}
- Droppable - Ignore new tasks while processing:
class CounterManager extends StateManager<CounterState> {
CounterManager()
: super(
const CounterState(0),
handler: droppable(),
);
}
- Restartable - Cancel current task when a new one comes in:
class CounterManager extends StateManager<CounterState> {
CounterManager()
: super(
const CounterState(0),
handler: restartable(),
);
}