HandleResultOfTypeOrNull

fun <T : Any> NavHostController.HandleResultOfTypeOrNull(serializer: KSerializer<T>, retain: Boolean = false, onResult: T?.() -> Unit)
@JvmName(name = "HandleResultOfNullableTypeOrNull")
fun <T> NavHostController.HandleResultOfTypeOrNull(serializer: KSerializer<T>, retain: Boolean = false, onResult: T?.() -> Unit)

Handles a Route.Result.Data matching a given type T. Requires that the Route.Result.Data.bundle is described by a SingleValueNavigationSpec matching NavigationBundleSpecType.SerializedType either directly or wrapped by NavigationBundleSpecType.OptionalType

Parameters

T

the type of serialized property stored in the result

serializer

The KSerializer to deserialize T from the result.

retain

If true the result will be retained in the NavBackStackEntry. It will be deleted otherwise.

onResult

Method for handling the received T or null