Ahmed
11/28/2024, 7:18 AMAhmed
11/28/2024, 7:18 AMNavHost(
navController = navController,
startDestination = BaseRouteGraphA,
modifier = Modifier.fillMaxSize(),
) {
graphA(
navController = navController,
onSomeThingSelected = {
navController.navigateToGraphB(it.myIdThatINeed)
}
)
graphB( … )
graphC( … )
}
And within graph B
I am currently obtaining the data
I need by
fun NavController.navigateToGraphB(myIdThatINeed: Int) {
navigate(route = BaseRouteGraphB(myIdThatINeed))
}
fun NavGraphBuilder.graphB( … ) {
navigation<BaseRouteGraphB>(startDestination = ScreenB1) {
composable<ScreenB1> { backStackEntry ->
backStackEntry.arguments.getInt("myIdThatINeed")
…
}
composable<ScreenB2> { … }
composable<ScreenB3> { … }
}
}
Ahmed
11/28/2024, 7:18 AMStylianos Gakis
11/28/2024, 8:28 AMAhmed
11/28/2024, 8:30 AMScreenB1
. But if you notice, the argument was passed to the BaseRouteGraphB
Stylianos Gakis
11/28/2024, 8:30 AMStylianos Gakis
11/28/2024, 8:31 AMStylianos Gakis
11/28/2024, 8:32 AMnavController.getBackStackEntry<BaseRouteGraphB>()
Ahmed
11/28/2024, 8:53 AMnavController.getBackStackEntry<BaseRouteGraphB>().toRoute<BaseRouteGraphB>()