Is the `NavUri` referenced in the doc a newer addi...
# multiplatform
r
Is the
NavUri
referenced in the doc a newer addition, and I gotta upgrade my kmp? https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-navigation-deep-links.html#handle-received-deep-links
z
Yes, as far as I remember off the top of my head, this is with the latest APIs in the navigation library. If you're using Compose Multiplatform 1.8.0, use Navigation 2.9.0-beta01, as listed on the bottom of the Release page https://github.com/JetBrains/compose-multiplatform/releases/tag/v1.8.0
r
Btw, got a weird bug with it:
Copy code
Caused by: kotlinx.serialization.SerializationException: Serializer for class 'StringUri' is not found.
                                                                                                    Please ensure that class is marked as '@Serializable' and that the serialization compiler plugin is applied.
With
Copy code
navigator.navigate(NavUri(uri)) {
                popUpTo(navigator.graph.id) {
                    inclusive = true
                }
            }
v
I have similar issue with Navigation 2.9.0-beta01:
kotlinx.serialization.SerializationException: Serializer for class 'ActualUri' is not found.
Please ensure that class is marked as '@Serializable' and that the serialization compiler plugin is applied.
The code:
navigator.navigate(NavUri(uri))
Maybe someone can help?
z
With the call above, that passes in a parameter and then a lambda for options, you're calling the wrong function, that will resolve to
Copy code
navigate(route: T, builder: NavOptionsBuilder.() -> Unit)
which expects a route object as a parameter, and
NavUri
isn't a valid route. You can make sure that you're calling a method that accepts a deep link by using a named parameter for that, for example:
Copy code
navigator.navigate(deepLink = NavUri(uri), navOptions {
    popUpTo(navigator.graph.id) {
        inclusive = true
    }
})
This would resolve to
Copy code
navigate(deepLink: NavUri, navOptions: NavOptions?)
which can handle a
NavUri
specifically.