selectState
Selects a module's state flow by its type.
This is the primary way to observe module state from within Logic classes or other components with access to a StoreAccessor.
Example:
class MyLogic(private val storeAccessor: StoreAccessor) : ModuleLogic() {
suspend fun checkUserState() {
val userState = storeAccessor.selectState<UserState>().first()
if (userState.isLoggedIn) {
// ...
}
}
}Content copied to clipboard
Return
StateFlow of the requested state type
Throws
if no module with the specified state type is registered