ViewModelLazy
class ViewModelLazy<VM : ViewModel> : Lazy<VM>
kotlin.Any | |
↳ | androidx.lifecycle.ViewModelLazy |
An implementation of Lazy used by androidx.fragment.app.Fragment.viewModels and androidx.activity.ComponentActivity.viewmodels.
storeProducer is a lambda that will be called during initialization, VM will be created in the scope of returned ViewModelStore.
factoryProducer is a lambda that will be called during initialization, returned ViewModelProvider.Factory will be used for creation of VM
Summary
Public constructors | |
---|---|
<init>(viewModelClass: KClass<VM>, storeProducer: () -> ViewModelStore, factoryProducer: () -> ViewModelProvider.Factory) An implementation of Lazy used by androidx.fragment.app.Fragment.viewModels and androidx.activity.ComponentActivity.viewmodels. |
Public methods | |
---|---|
Boolean |
Properties | |
---|---|
VM |
Public constructors
<init>
ViewModelLazy(
viewModelClass: KClass<VM>,
storeProducer: () -> ViewModelStore,
factoryProducer: () -> ViewModelProvider.Factory)
An implementation of Lazy used by androidx.fragment.app.Fragment.viewModels and androidx.activity.ComponentActivity.viewmodels.
storeProducer is a lambda that will be called during initialization, VM will be created in the scope of returned ViewModelStore.
factoryProducer is a lambda that will be called during initialization, returned ViewModelProvider.Factory will be used for creation of VM
Public methods
isInitialized
fun isInitialized(): Boolean
Properties
value
val value: VM