Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ExampleNavHostWithCustomNavType.kt
NavHost(...) {
composable("home") {
Home(
onClick = {
val example = Example("1", "Example")
val json = Uri.encode(Gson().toJson(example))
navController.navigate("details/$json")
}
)
}
composable(
"details/{example}",
arguments = listOf(
navArgument("example") {
type = ExampleNavType()
}
)
) {
val example = it.arguments?.getParcelable<Example>("example")
Details(example)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment