storeAndRemember
fun <ViewModel : BaseLifecycleViewModel> storeAndRemember(provider: @DisallowComposableCalls () -> ViewModel): ViewModel
fun <ViewModel : BaseLifecycleViewModel> storeAndRemember(key: Any?, provider: @DisallowComposableCalls () -> ViewModel): ViewModel
Deprecated
Does not work for configuration changes (e.g. rotation).
Replace with
import androidx.lifecycle.viewmodel.compose.viewModel
Content copied to clipboard
viewModel()
Content copied to clipboard
Stores and remembers a view model in the local ViewModelStore. Use if the view model was created manually and is not located in Activity/Fragment ViewModelStore. provider will only be evaluated during the composition. Recomposition will always return the value produced by provider.