Package 

Object MavericksViewModelProvider

    • Method Detail

      • get

         final <VM extends MavericksViewModel<S>, S extends MavericksState> VM get(Class<out VM> viewModelClass, Class<out S> stateClass, ViewModelContext viewModelContext, String key, Boolean forExistingViewModel, MavericksStateFactory<VM, S> initialStateFactory)

        Mavericks specific ViewModelProvider used for creating a BaseMavericksViewModel scoped to either a Fragment or ComponentActivity. If this is in a Fragment, it cannot be called before the Fragment has been added to an Activity or wrapped in a Lazy call.

        Parameters:
        viewModelClass - The class of the ViewModel you would like an instance of.
        stateClass - The class of the State used by the ViewModel.
        viewModelContext - The ViewModelContext which contains arguments and the owner of the ViewModel.
        key - An optional key for the ViewModel in the store.
        forExistingViewModel - If true the viewModel should already have been created.
        initialStateFactory - A way to specify how to create the initial state, can be mocked out for testing.