//reactivestate-compose/com.ensody.reactivestate.compose/onViewModel
onViewModel¶
[compose]\
inline fun <T> onViewModel(viewModelStoreOwner: ViewModelStoreOwner = checkNotNull(LocalViewModelStoreOwner.current) { "No ViewModelStoreOwner was provided via LocalViewModelStoreOwner" }, key: String? = null, crossinline provider: ReactiveStateContext.() -> T): T
Creates an object living on a wrapper ViewModel. This allows for building more flexible (e.g. nestable) ViewModels.
The provider should instantiate the object directly.
See also¶
reactiveState | if you want to instantiate a multiplatform ReactiveState ViewModel directly. |