I want to navigate to another screen, but i want to save current state, and then restore it. I tried to do as described in the bottom navigation documentation:
navController.navigate(Screen.CameraScreen.route) {
popUpTo(navController.graph.id) {
saveState = true
}
restoreState = true
}
But it doesn't work.
Try this:
navController.navigate(Screen.CameraScreen.route) {
navController.graph.startDestinationRoute?.let { route ->
popUpTo(route) {
saveState = true
}
}
launchSingleTop = true
restoreState = true
}