SavedStateNavEntryDecoratorKt

Added in 1.0.0-alpha02

public final class SavedStateNavEntryDecoratorKt


Summary

Public methods

static final @NonNull NavEntryDecorator<@NonNull Object>

Wraps the content of a NavEntry with a SaveableStateHolder.SaveableStateProvider to ensure that calls to rememberSaveable within the content work properly and that state can be saved.

static final @NonNull NavEntryDecorator<@NonNull Object>

Returns a SavedStateNavEntryDecorator that is remembered across recompositions.

Public methods

SavedStateNavEntryDecorator

public static final @NonNull NavEntryDecorator<@NonNull ObjectSavedStateNavEntryDecorator(
    @NonNull SaveableStateHolder saveableStateHolder
)

Wraps the content of a NavEntry with a SaveableStateHolder.SaveableStateProvider to ensure that calls to rememberSaveable within the content work properly and that state can be saved. Also provides the content of a NavEntry with a SavedStateRegistryOwner which can be accessed in the content with LocalSavedStateRegistryOwner.

This NavEntryDecorator is the only one that is required as saving state is considered a non-optional feature.

rememberSavedStateNavEntryDecorator

@Composable
public static final @NonNull NavEntryDecorator<@NonNull ObjectrememberSavedStateNavEntryDecorator(
    @NonNull SaveableStateHolder saveableStateHolder
)

Returns a SavedStateNavEntryDecorator that is remembered across recompositions.

Parameters
@NonNull SaveableStateHolder saveableStateHolder

the SaveableStateHolder that scopes the returned NavEntryDecorator