State Actor
open class StateActor<Context, S>(initial: S, scope: CoroutineScope) : StateStore<S> , Actor<Context, S> (source)
Holds state and provides synchronous updates + async action dispatching.
update uses MutableStateFlow.update internally (CAS retry) — concurrent updates from multiple actions are safe.
Dispatch modes:
effect: fire-and-forget — launches in the actor's scope.
immediateUntil: dispatch + suspend until state matches a condition.
Interceptors
actor.onUpdate { reducer, next ->
next(reducer) // call to proceed, skip to suppress
}
actor.onAction { action, next ->
next() // call to proceed, skip to suppress
}Content copied to clipboard
Inheritors
Functions
Link copied to clipboard
open suspend override fun <Ctx> immediateUntil(ctx: Ctx, action: TypedAction<Ctx>, until: (S) -> Boolean): S
Dispatch action and suspend until state matches until.
Link copied to clipboard
Add an async interceptor that wraps the action's suspend execution. Runs inside the coroutine — next() suspends until the action completes.