ViewModelStore



Class to store ViewModels.

Instances of ViewModelStore must be retained through configuration changes. If the owner of a ViewModelStore, typically a `ViewModelStoreOwner`, is destroyed and recreated due to a configuration change, the new owner must have the old instance of the ViewModelStore.

If the owner of a ViewModelStore is destroyed and is not going to be recreated, it should call `clear` on this ViewModelStore so that The ViewModels stored by it are notified that they are no longer needed.

Use `ViewModelStoreOwner.getViewModelStore` to retrieve a ViewModelStore for activities and fragments.

Summary

Public constructors

Cmn

Public functions

Unit

Clears internal storage and notifies ViewModels that they are no longer used.

Cmn

Public constructors

ViewModelStore

ViewModelStore()

Public functions

clear

fun clear(): Unit

Clears internal storage and notifies ViewModels that they are no longer used.