Fragment View Model Context
data class FragmentViewModelContext(activity: ComponentActivity, args: Any?, fragment: Fragment, owner: ViewModelStoreOwner, savedStateRegistry: SavedStateRegistry) : ViewModelContext
Content copied to clipboard
The ViewModelContext for a ViewModel created with a fragment scope (val viewModel by fragmentViewModel<MyViewModel>).
The owner and savedStateRegistry default to the Fragment as the provider, if you need to use an alternative source for the ViewModelStoreOwner and/or SavedStateRegistry; such in the case of JetPack Navigation Component destinations with ViewModels, then you can provided them via this context.
Constructors
FragmentViewModelContext
Link copied to clipboard
fun FragmentViewModelContext(activity: ComponentActivity, args: Any?, fragment: Fragment, owner: ViewModelStoreOwner = fragment, savedStateRegistry: SavedStateRegistry = fragment.savedStateRegistry)
Content copied to clipboard
Functions
Properties
activity
Link copied to clipboard
args
Link copied to clipboard
Fragment arguments set via Mavericks.KEY_ARG.