Since Compose Navigation added NavOptions in alpha...
# compose
Since Compose Navigation added NavOptions in alpha02, I'm trying to use it but I dont understand how can I specify a popUpTo destination as it requires an Id(Int) and we only have route(string) in the Compose navigation graph. Thanks for your help guys!
🙏🏼 1
hey i think i was stuck like you a bit earlier, try yhis syntax:
Copy code
navController.navigate(screen.route) {
                        launchSingleTop = true
                        popUpTo = navController.graph.startDestination
Thanks @Ian Lake, I missed that and it solved my issues!
👍 1
@Cyril Find I've seen that but it only allows me to browse to the startDestination, my question was about navigating to any route using popUpTo
ah yeah right i didn't look at the link, that's what i used first too but i changed it since for start destination it simpler this way but i forgot to change it back for you 😄 ... anyway it's solved 👍
Yeah, if you're popping the the start destination, you're using the ID (and can save duplicating your route and keeping that in sync), but for anything else, you'd want to use the route version.