-
public final 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, Function1<SettingsBuilder, Unit> buildSettings, SuspendFunction1<SimpleSyntax<STATE, SIDE_EFFECT>, 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, SuspendFunction1<SimpleSyntax<STATE, SIDE_EFFECT>, Unit> onCreate)Creates a container scoped with ViewModelScope and allows you to used the Android ViewModel's saved state support. -
-
Method Detail
-
container
final static <STATE extends Any, SIDE_EFFECT extends Any> Container<STATE, SIDE_EFFECT> container(ViewModel $self, STATE initialState, Function1<SettingsBuilder, Unit> buildSettings, SuspendFunction1<SimpleSyntax<STATE, SIDE_EFFECT>, 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 intent 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, SuspendFunction1<SimpleSyntax<STATE, SIDE_EFFECT>, 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 intent to execute when the container is created, provided with the default or recreated state
-
-
-
-