AN
03/28/2023, 1:27 PMStylianos Gakis
03/28/2023, 2:55 PMAN
03/28/2023, 9:39 PMnavBackStackEntry?.destination?.hierarchy?.any {
it.route == item.getRoute()
} == true
Shouldn't that check if the given destination is present in the backstack?Stylianos Gakis
03/28/2023, 10:32 PMitem.getRoute()
and what that returns, but I’ll just assume it’s the right thing.
Now the next question would be, how are you getting navBackStackEntry
? Any chance you’re somehow referring to stale information by calling currentBackStackEntry
and not listening to the currentBackStackEntryAsState
or something like that?
Scouring this sub there’s plenty of examples where they do this exact same thing as you are trying to do, so it should work?
A quick search in this channel for “hierarchy?.any” brings some results
https://kotlinlang.slack.com/archives/CJLTWPH7S/p1655344229608759?thread_ts=1655344206.778579&cid=CJLTWPH7S
https://kotlinlang.slack.com/archives/CJLTWPH7S/p1654796984543839?thread_ts=1654793995.106589&cid=CJLTWPH7S
https://kotlinlang.slack.com/archives/CJLTWPH7S/p1654794017709439?thread_ts=1654793995.106589&cid=CJLTWPH7S
https://kotlinlang.slack.com/archives/CJLTWPH7S/p1646298469736739
Maybe scour some more yourself too and see if any one of them can help you figure it out? 😄