ReactiveViewModel
Base class for ViewModels.
The scope is meant to be filled with ContextualVal entries.
For example, the ContextualOnInit hook can be used to launch coroutines via a CoroutineLauncher directly from the ViewModel constructor, so you can have nicer error handling and loading indicators.
Functions
Watches observables for changes. Often useful to keep things in sync (e.g. CoroutineLauncher -> UI).
Watches observables for changes. Often useful to keep things in sync (e.g. CoroutineLauncher -> UI).
Creates a StateFlow that computes its value based on other StateFlows via an autoRun block.
Creates a StateFlow that computes its value based on other StateFlows via a suspendable coAutoRun block.
Helper for adding a completion handler to a CoroutineLauncher.
Launches a coroutine. Mark long-running coroutines by setting withLoading to loading state.
Launches a coroutine without any error handling or loading state tracking.
Runs OnInit.trigger for this class.