SavedStateHandle.Companion


public static class SavedStateHandle.Companion


Summary

Extension functions

static final @NonNull SavedStateHandle

SavedStateHandle constructor to create a SavedStateHandle with a serializable object.

Extension functions

SavedStateHandleFactoryKt.invoke

public static final @NonNull SavedStateHandle SavedStateHandleFactoryKt.invoke(
    @NonNull SavedStateHandle.Companion receiver,
    @NonNull Object route,
    @NonNull Map<@NonNull KType, @NonNull NavType<@NonNull ?>> typeMap
)

SavedStateHandle constructor to create a SavedStateHandle with a serializable object.

Returns a SavedStateHandle populated with arguments from route.

Note: To use this api in non-instrumented tests, run with robolectric. This is because android's Bundle is necessarily integrated into the parsing of route arguments.

Parameters
@NonNull Object route

The route to extract argument values from

@NonNull Map<@NonNull KType, @NonNull NavType<@NonNull ?>> typeMap

A mapping of KType to custom NavType<*> in the route. May be empty if route does not use custom NavTypes.