androidx.hilt.lifecycle.viewmodel.compose
Top-level functions summary
inline VM |
@Composable Returns an existing HiltViewModel -annotated |
inline VM |
@Composable Returns an existing HiltViewModel -annotated |
Top-level functions
hiltViewModel
@Composable
inline fun <VM : ViewModel> hiltViewModel(
viewModelStoreOwner: ViewModelStoreOwner = checkNotNull(LocalViewModelStoreOwner.current) { "No ViewModelStoreOwner was provided via LocalViewModelStoreOwner" },
key: String? = null
): VM
Returns an existing HiltViewModel -annotated ViewModel
or creates a new one scoped to the current ViewModelStoreOwner
.
hiltViewModel
@Composable
inline fun <VM : ViewModel, VMF : Any?> hiltViewModel(
viewModelStoreOwner: ViewModelStoreOwner = checkNotNull(LocalViewModelStoreOwner.current) { "No ViewModelStoreOwner was provided via LocalViewModelStoreOwner" },
key: String? = null,
noinline creationCallback: (VMF) -> VM
): VM
Returns an existing HiltViewModel -annotated ViewModel
with an @AssistedInject-annotated constructor or creates a new one scoped to the current ViewModelStoreOwner
.