WrapperViewModel
The wrapper ViewModel used by buildOnViewModel.
Functions
Link copied to clipboard
Link copied to clipboard
fun ViewModel.autoRun(launcher: CoroutineLauncher = if (this is CoroutineLauncher) this else SimpleCoroutineLauncher(viewModelScope), onChange: <Error class: unknown class><Unit>? = null, observer: <Error class: unknown class><Unit>): AutoRunner<Unit>
Watches observables for changes. Often useful to keep things in sync.
Link copied to clipboard
fun ViewModel.coAutoRun(launcher: CoroutineLauncher = if (this is CoroutineLauncher) this else SimpleCoroutineLauncher(viewModelScope), onChange: <Error class: unknown class><Unit>? = null, observer: <Error class: unknown class><Unit>): CoAutoRunner<Unit>
Watches observables for changes. Often useful to keep things in sync.
Link copied to clipboard
fun <T> ViewModel.derived(launcher: CoroutineLauncher = if (this is CoroutineLauncher) this else SimpleCoroutineLauncher(viewModelScope), synchronous: Boolean = true, observer: <Error class: unknown class><T>): StateFlow<T>
Creates a StateFlow that computes its value based on other StateFlows via an autoRun block.
fun <T> ViewModel.derived(initial: T, started: SharingStarted = SharingStarted.Eagerly, launcher: CoroutineLauncher = if (this is CoroutineLauncher) this else SimpleCoroutineLauncher(viewModelScope), flowTransformer: <Error class: unknown class> = { conflatedWorker(transform = it) }, dispatcher: CoroutineDispatcher = dispatchers.main, withLoading: MutableStateFlow<Int>? = if (this is CoroutineLauncher) launcher.loading else null, observer: <Error class: unknown class><T>): StateFlow<T>
Creates a StateFlow that computes its value based on other StateFlows via a suspendable coAutoRun block.
Link copied to clipboard