SavedStateValue


public interface SavedStateValue<T extends Object> extends SavedStateRegistry.SavedStateProvider, SavedStateRegistry.SavedStateRestorer


Interface representing a saved state component holding a value.

A SavedStateValue combines state saving (SavedStateProvider) and restoration (SavedStateRestorer) with direct access to the underlying value.

Parameters
<T extends Object>

type of the underlying value

Summary

Public methods

abstract @NonNull T

The current value held by this saved state component.

Extension functions

default final T
<T extends Object> SavedStateValueKt.getValue(
    SavedStateValue<@NonNull T> receiver,
    Object thisRef,
    @NonNull KProperty<@NonNull ?> property
)

Delegates read-only properties (val x by savedStateValue) directly to SavedStateValue.value.

Inherited methods

From androidx.savedstate.SavedStateRegistry.SavedStateProvider
abstract @NonNull SavedState

Called to retrieve the state from a component before it is killed so the state can be retrieved later from consumeRestoredStateForKey.

From androidx.savedstate.SavedStateRegistry.SavedStateRestorer
abstract void

Called to restore the state of a component.

Public methods

getValue

Added in 1.6.0-alpha07
abstract @NonNull T getValue()

The current value held by this saved state component.

Extension functions

SavedStateValueKt.getValue

default final T <T extends Object> SavedStateValueKt.getValue(
    SavedStateValue<@NonNull T> receiver,
    Object thisRef,
    @NonNull KProperty<@NonNull ?> property
)

Delegates read-only properties (val x by savedStateValue) directly to SavedStateValue.value.