Package 

Class ViewModelExtensionsKt

    • Method Summary

      Modifier and Type Method Description
      final static <STATE extends Any, SIDE_EFFECT extends Any> Container<STATE, SIDE_EFFECT> container(ViewModel $self, STATE initialState, Container.Settings settings, Function1<STATE, Unit> onCreate) Creates a container scoped with ViewModelScope.
      final static <STATE extends Parcelable, SIDE_EFFECT extends Any> Container<STATE, SIDE_EFFECT> container(ViewModel $self, STATE initialState, SavedStateHandle savedStateHandle, Container.Settings settings, Function1<STATE, Unit> onCreate) Creates a container scoped with ViewModelScope and allows you to used the Android ViewModel's saved state support.
      final static <STATE extends Any, SIDE_EFFECT extends Any> Container<STATE, SIDE_EFFECT> container(ViewModel $self, STATE initialState, Function1<SettingsBuilder, Unit> buildSettings, Function1<STATE, Unit> onCreate) Creates a container scoped with ViewModelScope.
      final static <STATE extends Parcelable, SIDE_EFFECT extends Any> Container<STATE, SIDE_EFFECT> container(ViewModel $self, STATE initialState, SavedStateHandle savedStateHandle, Function1<SettingsBuilder, Unit> buildSettings, Function1<STATE, Unit> onCreate) Creates a container scoped with ViewModelScope and allows you to used the Android ViewModel's saved state support.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • container

         final static <STATE extends Any, SIDE_EFFECT extends Any> Container<STATE, SIDE_EFFECT> container(ViewModel $self, STATE initialState, Container.Settings settings, Function1<STATE, Unit> onCreate)

        Creates a container scoped with ViewModelScope.

        Parameters:
        initialState - The initial state of the container.
        settings - The Container.Settings to set the container up with.
        onCreate - The lambda to execute when the container is created.
      • container

         final static <STATE extends Parcelable, SIDE_EFFECT extends Any> Container<STATE, SIDE_EFFECT> container(ViewModel $self, STATE initialState, SavedStateHandle savedStateHandle, Container.Settings settings, Function1<STATE, Unit> onCreate)

        Creates a container scoped with ViewModelScope and allows you to used the Android ViewModel's saved state support.

        Provide a SavedStateHandle in order for your Parcelable state to be automatically saved as you use the container.

        Parameters:
        initialState - The initial state of the container.
        savedStateHandle - The SavedStateHandle corresponding to this host.
        settings - The Container.Settings to set the container up with.
        onCreate - The lambda to execute when the container is created, parameter is false, or recreated, parameter is true.
      • container

         final static <STATE extends Any, SIDE_EFFECT extends Any> Container<STATE, SIDE_EFFECT> container(ViewModel $self, STATE initialState, Function1<SettingsBuilder, Unit> buildSettings, Function1<STATE, Unit> onCreate)

        Creates a container scoped with ViewModelScope.

        Parameters:
        initialState - The initial state of the container.
        buildSettings - This builder can be used to change the container's settings.
        onCreate - The lambda to execute when the container is created.
      • container

         final static <STATE extends Parcelable, SIDE_EFFECT extends Any> Container<STATE, SIDE_EFFECT> container(ViewModel $self, STATE initialState, SavedStateHandle savedStateHandle, Function1<SettingsBuilder, Unit> buildSettings, Function1<STATE, Unit> onCreate)

        Creates a container scoped with ViewModelScope and allows you to used the Android ViewModel's saved state support.

        Provide a SavedStateHandle in order for your Parcelable state to be automatically saved as you use the container.

        Parameters:
        initialState - The initial state of the container.
        savedStateHandle - The SavedStateHandle corresponding to this host.
        buildSettings - This builder can be used to change the container's settings.
        onCreate - The lambda to execute when the container is created, parameter is false, or recreated, parameter is true.