natario1
03/03/2021, 12:50 PMnavBackStackEntry?.arguments?.getString(KEY_ROUTE)
gives null when you go back to the start tab, so the nav item won't be highlighted. What works is
val backstackRoute = backstackEntry?.arguments?.getString(KEY_ROUTE)
val fallbackRoute = runCatching {
nav.graph.findNode(nav.graph.startDestination)!!.arguments[KEY_ROUTE]!!.defaultValue
}.getOrNull()
val currentRoute = backstackRoute ?: fallbackRoute
(runCatching otherwise nav.graph can throw on first composition). What's wrong here? Do we need at least a better API for peeking the current route?