vector / com.haroldadmin.vector / VectorViewModelProvider
VectorViewModelProvider¶
object VectorViewModelProvider
A class which is responsible for creating ViewModel instances.
Instantiation of a ViewModel is first attempted using its companion object if it implements VectorViewModelFactory. If this fails, then the instantiation using the constructor is attempted. If this fails too, then an error is thrown.
Functions¶
Name | Summary |
---|---|
createViewModel | fun <VM : VectorViewModel < S >, S : VectorState > createViewModel(vmClass: KClass <out VM >, stateClass: KClass <out S >, owner: ViewModelOwner , savedStateRegistryOwner: SavedStateRegistryOwner , stateStoreContext: CoroutineContext ): VM |
get | fun <VM : VectorViewModel < S >, S : VectorState > get(vmClass: KClass <out VM >, stateClass: KClass <out S >, savedStateRegistryOwner: SavedStateRegistryOwner , viewModelOwner: ViewModelOwner , stateStoreContext: CoroutineContext ): VM Creates the requested ViewModel automatically using reflection, and returns it. The returned ViewModel is already registered with a ViewModelProvider fun <VM : VectorViewModel < S >, S : VectorState > get(vmClass: KClass <out VM >, stateClass: KClass <out S >, viewModelOwner: ViewModelOwner , savedStateRegistryOwner: SavedStateRegistryOwner , viewModelProducer: (initialState: S , handle: SavedStateHandle ) -> VM ): VM Creates and returns the requested ViewModel using the supplied viewModelProducer and returns it. The returned ViewModel is already registered with a ViewModelProvider |