Passing URL as a parameter to Jetpack Compose Navigation

Navigation routes are equivalent to urls. Generally you’re supposed to pass something like id there.

When you need to pass a url inside another url, you need to encode it:

val encodedUrl = URLEncoder.encode("http://alphaone.me/", StandardCharsets.UTF_8.toString())
navController.navigate("HistoryDetail/$encodedUrl")

Leave a Comment