androidx.hilt.navigation


Top-level functions summary

ViewModelProvider.Factory
HiltViewModelFactory(
    context: Context,
    delegateFactory: ViewModelProvider.Factory
)

Creates a ViewModelProvider.Factory to get HiltViewModel -annotated ViewModel from a ViewModelProvider.Factory.

ViewModelProvider.Factory
HiltViewModelFactory(
    context: Context,
    navBackStackEntry: NavBackStackEntry
)

Creates a ViewModelProvider.Factory to get HiltViewModel -annotated ViewModel from a NavBackStackEntry.

Top-level functions

HiltViewModelFactory

fun HiltViewModelFactory(
    context: Context,
    delegateFactory: ViewModelProvider.Factory
): ViewModelProvider.Factory

Creates a ViewModelProvider.Factory to get HiltViewModel -annotated ViewModel from a ViewModelProvider.Factory.

Parameters
context: Context

the activity context.

delegateFactory: ViewModelProvider.Factory

the delegated factory.

Returns
ViewModelProvider.Factory

the factory.

Throws
kotlin.IllegalStateException

if the context given is not an activity.

HiltViewModelFactory

fun HiltViewModelFactory(
    context: Context,
    navBackStackEntry: NavBackStackEntry
): ViewModelProvider.Factory

Creates a ViewModelProvider.Factory to get HiltViewModel -annotated ViewModel from a NavBackStackEntry.

Parameters
context: Context

the activity context.

navBackStackEntry: NavBackStackEntry

the navigation back stack entry.

Returns
ViewModelProvider.Factory

the factory.

Throws
kotlin.IllegalStateException

if the context given is not an activity.