asTypeOfOrNull

fun <T : Any> Bundle.asTypeOfOrNull(serializer: KSerializer<T>): T?

Converts a Bundle to T if is described by a SingleValueNavigationSpec matching the NavigationBundleSpecType.SerializedType with serializer either directly or wrapped by NavigationBundleSpecType.OptionalType.

Return

The T stored in the bundle or null if no such value was found.

Parameters

T

the type of serialized property stored in the bundle

serializer

The KSerializer to deserialize T from the bundle.


@JvmName(name = "asNullableTypeOfOrNull")
fun <T> Bundle.asTypeOfOrNull(serializer: KSerializer<T>): T?

Converts a Bundle to T if is described by a SingleValueNavigationSpec matching the NavigationBundleSpecType.SerializedType with serializer.

Return

The T stored in the bundle or null if no such value was found.

Parameters

T

the type of serialized property stored in the bundle

serializer

The KSerializer to deserialize T from the bundle.