SavedStateHandleFactoryKt

Added in 2.8.0

public final class SavedStateHandleFactoryKt


Summary

Public methods

static final @NonNull <Error class: unknown class>
invoke(
    @NonNull <Error class: unknown class> receiver,
    @NonNull Object route,
    @NonNull Map<@NonNull KType, @NonNull NavType<@NonNull ?>> typeMap
)

SavedStateHandle constructor to create a SavedStateHandle with a serializable object.

Public methods

public static final @NonNull <Error class: unknown class> invoke(
    @NonNull <Error class: unknown class> 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.