yx_state_transformers 1.0.0 copy "yx_state_transformers: ^1.0.0" to clipboard
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:

  1. Sequential - Process tasks one after another in order:
class CounterManager extends StateManager<CounterState> {
    CounterManager()
      : super(
          const CounterState(0),
          handler: sequential(),
      );
}
  1. Concurrent - Process tasks in parallel:
class CounterManager extends StateManager<CounterState> {
    CounterManager()
      : super(
          const CounterState(0),
          handler: concurrent(),
      );
}
  1. Droppable - Ignore new tasks while processing:
class CounterManager extends StateManager<CounterState> {
    CounterManager()
      : super(
          const CounterState(0),
          handler: droppable(),
      );
}
  1. Restartable - Cancel current task when a new one comes in:
class CounterManager extends StateManager<CounterState> {
    CounterManager()
      : super(
          const CounterState(0),
          handler: restartable(),
      );
}