androidx.lifecycle.viewmodel


Interfaces

CreationExtras.Key

Key for the elements of CreationExtras.

Cmn

Classes

CreationExtras

A map-like object holding pairs of CreationExtras.Key and Any, enabling efficient value retrieval for each key.

Cmn
InitializerViewModelFactoryBuilder

DSL for constructing a new ViewModelProvider.Factory

Cmn
MutableCreationExtras

A modifiable CreationExtras that holds pairs of CreationExtras.Key and Any, allowing efficient value retrieval for each key.

Cmn
ViewModelInitializer

Holds a ViewModel class and initializer for that class

Cmn
android
N

Objects

CreationExtras.Empty

An empty read-only CreationExtras.

Cmn

Annotations

Top-level functions summary

inline ViewModelProvider.Factory

Creates an InitializerViewModelFactory with the initializers provided in the builder.

Cmn

Extension functions summary

operator Boolean

Checks if the CreationExtras contains the given key.

Cmn
inline Unit
<VM : ViewModel> InitializerViewModelFactoryBuilder.initializer(
    noinline initializer: CreationExtras.() -> VM
)

Add an initializer to the InitializerViewModelFactoryBuilder

Cmn
operator MutableCreationExtras

Creates a new read-only CreationExtras by replacing or adding entries to this extras from another creationExtras.

Cmn
operator Unit

Appends or replaces all entries from the given creationExtras in this mutable extras.

Cmn

Top-level functions

viewModelFactory

inline fun viewModelFactory(builder: InitializerViewModelFactoryBuilder.() -> Unit): ViewModelProvider.Factory

Creates an InitializerViewModelFactory with the initializers provided in the builder.

Extension functions

operator fun CreationExtras.contains(key: CreationExtras.Key<*>): Boolean

Checks if the CreationExtras contains the given key.

This method allows to use the key in creationExtras syntax for checking whether an key is contained in the CreationExtras.

inline fun <VM : ViewModel> InitializerViewModelFactoryBuilder.initializer(
    noinline initializer: CreationExtras.() -> VM
): Unit

Add an initializer to the InitializerViewModelFactoryBuilder

operator fun CreationExtras.plus(creationExtras: CreationExtras): MutableCreationExtras

Creates a new read-only CreationExtras by replacing or adding entries to this extras from another creationExtras.

The returned CreationExtras preserves the entry iteration order of the original CreationExtras.

Those entries of another creationExtras that are missing in this extras are iterated in the end in the order of that creationExtras.

operator fun MutableCreationExtras.plusAssign(creationExtras: CreationExtras): Unit

Appends or replaces all entries from the given creationExtras in this mutable extras.