orbitContainer

fun <STATE : Parcelable, SIDE_EFFECT : Any> ViewModel.orbitContainer(initialState: STATE, savedStateHandle: SavedStateHandle, buildSettings: SettingsBuilder.() -> Unit = {}, onCreate: suspend Syntax<STATE, SIDE_EFFECT>.() -> Unit? = null): OrbitContainer<STATE, STATE, SIDE_EFFECT>(source)

Creates a container scoped with ViewModelScope with Android ViewModel's saved state support for Parcelable state.

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

Return

An OrbitContainer implementation

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 intent to execute when the container is created


Creates a container scoped with ViewModelScope with external state transformation and Android ViewModel's saved state support for Parcelable state.

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

Return

An OrbitContainer implementation

Parameters

initialState

The initial state of the container.

savedStateHandle

The SavedStateHandle corresponding to this host.

transformState

The function that transforms the internal state to the external state.

buildSettings

This builder can be used to change the container's settings.

onCreate

The intent to execute when the container is created

fun <STATE : Any, SIDE_EFFECT : Any> ViewModel.orbitContainer(initialState: STATE, buildSettings: SettingsBuilder.() -> Unit = {}, onCreate: suspend Syntax<STATE, SIDE_EFFECT>.() -> Unit? = null): OrbitContainer<STATE, STATE, SIDE_EFFECT>(source)

Creates a container scoped with ViewModelScope.

Return

An OrbitContainer implementation

Parameters

initialState

The initial state of the container.

buildSettings

This builder can be used to change the container's settings.

onCreate

The intent to execute when the container is created


Creates a container scoped with ViewModelScope with external state transformation.

Return

An OrbitContainer implementation

Parameters

initialState

The initial state of the container.

transformState

The function that transforms the internal state to the external state.

buildSettings

This builder can be used to change the container's settings.

onCreate

The intent to execute when the container is created


fun <STATE : Any, SIDE_EFFECT : Any> ViewModel.orbitContainer(initialState: STATE, savedStateHandle: SavedStateHandle, serializer: KSerializer<STATE>, buildSettings: SettingsBuilder.() -> Unit = {}, onCreate: suspend Syntax<STATE, SIDE_EFFECT>.() -> Unit? = null): OrbitContainer<STATE, STATE, SIDE_EFFECT>(source)

Creates a container scoped with ViewModelScope with saved state support.

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

Return

An OrbitContainer implementation

Parameters

initialState

The initial state of the container.

savedStateHandle

The SavedStateHandle corresponding to this host. Typically retrieved from the containing ViewModel

serializer

The KSerializer to use for serializing and deserializing state.

buildSettings

This builder can be used to change the container's settings.

onCreate

The intent to execute when the container is created


fun <INTERNAL_STATE : Any, EXTERNAL_STATE : Any, SIDE_EFFECT : Any> ViewModel.orbitContainer(initialState: INTERNAL_STATE, savedStateHandle: SavedStateHandle, serializer: KSerializer<INTERNAL_STATE>, transformState: (INTERNAL_STATE) -> EXTERNAL_STATE, buildSettings: SettingsBuilder.() -> Unit = {}, onCreate: suspend Syntax<INTERNAL_STATE, SIDE_EFFECT>.() -> Unit? = null): OrbitContainer<INTERNAL_STATE, EXTERNAL_STATE, SIDE_EFFECT>(source)

Creates a container scoped with ViewModelScope with external state transformation and saved state support.

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

Return

An OrbitContainer implementation

Parameters

initialState

The initial state of the container.

savedStateHandle

The SavedStateHandle corresponding to this host.

serializer

The KSerializer to use for serializing and deserializing state.

transformState

The function that transforms the internal state to the external state.

buildSettings

This builder can be used to change the container's settings.

onCreate

The intent to execute when the container is created