StoreAccessor
Provides access to dispatch, state selection, and logic selection.
StoreAccessor is passed to Logic classes during construction, allowing them to dispatch actions, read state from other modules, and access other Logic instances.
Example:
class OrderLogic(private val storeAccessor: StoreAccessor) : ModuleLogic() {
suspend fun placeOrder(order: Order) {
// Dispatch an action
storeAccessor.dispatch(OrderAction.SetProcessing(true))
// Read state from another module
val userState = storeAccessor.selectState<UserState>().first()
// Access another module's logic
val paymentLogic = storeAccessor.selectLogic<PaymentLogic>()
paymentLogic.processPayment(order.total)
}
}Inheritors
Functions
Registers a CrashListener to be notified when logic invocation throws.
Provides access to internal store operations for specialized use cases.
Dispatch an action and wait for it to be processed. Returns a DispatchResult indicating whether the action was applied or blocked.
A snapshot of every registered module's current state, keyed by the state class's qualified name.
Returns the logic instance for the given module, suspending until the store is fully initialized.
Returns all modules registered in this store.
Removes a previously registered CrashListener.
Launches reset on the store's root job and returns immediately.
Select a module's logic instance by its class.
Selects a module's logic instance by its type.
Select a module's state flow by its class.
Selects a module's state flow by its type.