StateViewModel

abstract class StateViewModel<S : Any>(initial: S) : ViewModel

State-plumbing-only base for screens that don't need one-shot navigation effects (yet).

No Action/Effect generics, no kotlinx.coroutines.channels.Channel, no broadcast — just a StateFlow of S and a setState reducer. Reach for BaseViewModel instead the moment a screen needs a one-shot effect (navigation, toast, one-shot dialog); this class won't grow that capability in place, it's deliberately the smaller of the two.

Constructors

Link copied to clipboard
constructor(initial: S)

Properties

Link copied to clipboard
val state: StateFlow<S>

Functions

Link copied to clipboard
expect open fun addCloseable(closeable: AutoCloseable)
expect fun addCloseable(key: String, closeable: AutoCloseable)
Link copied to clipboard
expect fun <T : AutoCloseable> getCloseable(key: String): T?