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.
Returns the logic instance for the given module, suspending until the store is fully initialized.
Returns all modules registered in this store.
Returns the StateFlow for the given module's state, or null if the module is not registered in this store.
Removes a previously registered CrashListener.
Non-suspend convenience function that resets the store asynchronously.
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.