public final class SavedState


An opaque (empty) common type that holds saveable values to be saved and restored by native platforms that have a concept of System-initiated Process Death.

That means, the OS will give the chance for the process to keep the state of the application (normally using a serialization mechanism), and allow the app to restore its state later. That is commonly referred to as "state restoration".

required to act as a source input for a SavedStateReader or SavedStateWriter.

This class represents a container for persistable state data. It is designed to be platform-agnostic, allowing seamless state saving and restoration across different environments.

Summary

Extension functions

final @NonNull T
<T extends Object> SavedStateKt.read(
    @NonNull SavedState receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull SavedStateReader, @NonNull T> block
)

Calls the specified function block with a SavedStateReader value as its receiver and returns the block value.

final @NonNull SavedStateReader

Creates a new SavedStateReader for the SavedState.

final @NonNull T
<T extends Object> SavedStateKt.write(
    @NonNull SavedState receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull SavedStateWriter, @NonNull T> block
)

Calls the specified function block with a SavedStateWriter value as its receiver and returns the block value.

final @NonNull SavedStateWriter

Creates a new SavedStateWriter for the SavedState.

Extension functions

SavedStateKt.read

public final @NonNull T <T extends Object> SavedStateKt.read(
    @NonNull SavedState receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull SavedStateReader, @NonNull T> block
)

Calls the specified function block with a SavedStateReader value as its receiver and returns the block value.

Parameters
@ExtensionFunctionType @NonNull Function1<@NonNull SavedStateReader, @NonNull T> block

A lambda function that performs read operations using the SavedStateReader.

Returns
@NonNull T

The result of the lambda function's execution.

SavedStateKt.reader

public final @NonNull SavedStateReader SavedStateKt.reader(@NonNull SavedState receiver)

Creates a new SavedStateReader for the SavedState.

SavedStateKt.write

public final @NonNull T <T extends Object> SavedStateKt.write(
    @NonNull SavedState receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull SavedStateWriter, @NonNull T> block
)

Calls the specified function block with a SavedStateWriter value as its receiver and returns the block value.

Parameters
@ExtensionFunctionType @NonNull Function1<@NonNull SavedStateWriter, @NonNull T> block

A lambda function that performs write operations using the SavedStateWriter.

Returns
@NonNull T

The result of the lambda function's execution.

SavedStateKt.writer

public final @NonNull SavedStateWriter SavedStateKt.writer(@NonNull SavedState receiver)

Creates a new SavedStateWriter for the SavedState.