In jetpack navigation compose, how do I do the following in a typesafe manner (using classes, not strings … this is from
JetSnackNavController
)
Copy code
fun navigateToBottomBarRoute(route: String) {
if (route != navController.currentDestination?.route)
The goal is to prevent the user from pressing the same top level Route over and over, which based on the typical Bottom Nav code I see, causes the `compose`<> block to rerun, viewmodels to be recreated, etc.
e
escodro
02/28/2025, 2:01 PM
Hello!
In my app, I'm using the
hasRoute()
API, which is very useful for comparing the typesafe with the BackStackEntry. Something like: