I want to hide my bottom nav on certain screens. Right now I'm using the
route to compare destinations. This doesn't work with optional arguments anymore, because the
route
property of the `navBackStackEntry`'s
destination
contains the
argument syntax. But in order to add arguments later, my own route string needs to be the "base" route without arguments.
val navBackStackEntry by navController.currentBackStackEntryAsState()
val currentDestination = navBackStackEntry?.destination
val hideBottomNav = fullScreenDestinations.any { destination ->
destination.route == currentDestination?.route
}
So here
destination.route
=
"AddEditTask"
while
currentDestination.route
=
"AddEditTask?taskId=taskID"
.
How else could I check what destination we are currently on?
using
contains
to compare a sub-string seems error-prone.