EventConcurrency enum
How same-type events are processed relative to one another.
Juice dispatches each event independently, so without a policy two events of
the same type can interleave at every await inside a use case (the
"read state before an await, write a stale value after" race). Every
builder DECLARES its mode (concurrency: is required) — a mode is a
decision, and the compiler asks for it.
Values
- concurrent → const EventConcurrency
-
Same-type use cases may run concurrently (interleave at awaits). Use for genuinely independent events; follow the read-at-emit discipline.
- sequential → const EventConcurrency
-
Same-type events queue and run one at a time, in order; each use case completes (including its awaits) before the next starts. Eliminates the read-before-await race for that event type.
- droppable → const EventConcurrency
-
A same-type event arriving while one is already running is dropped. Replaces hand-rolled "busy" guard flags for exclusive flows.
- restartable → const EventConcurrency
-
A same-type event arriving while one is running supersedes it and starts immediately: typeahead, search, filter, select — the latest input must win. Dart cannot kill the superseded run, so it is FENCED: its
emitUpdate/emitWaiting/emitFailure/emitCancel/emitEvent/navigatebecome no-ops (each logged asstate_emission_superseded), the stream bindings it created are cancelled, and if its event is aCancellableEventit is cancelled so the run can bail early (BlocUseCase.isSupersededis the check for any other event). Side effects already performed are NOT rolled back — restartable fences state, not the world.sendAndWaiton a superseded event returns aCancelingStatusinstead of timing out.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
EventConcurrency> - A constant List of the values in this enum, in order of their declaration.