How to convert or compare NavDestination into a na...
# compose
m
How to convert or compare NavDestination into a navigation type?
Copy code
if (destination == ProductPage(productId))
1
p
Another hack i have used val navBackStackEntry by navController.currentBackStackEntryAsState() when (navBackStackEntry?.destination?.id) { Home.serializer().generateHashCode() -> { selectedItem = 0 } Settings.serializer().generateHashCode() -> { selectedItem = 1 } }
i
As explained in the last thread about this, you should absolutely not ever be relying on any of that Prashant: https://kotlinlang.slack.com/archives/C04TPPEQKEJ/p1726495684981239?thread_ts=1726479662.622609&cid=C04TPPEQKEJ
👍 1