Rohan Maity
08/11/2022, 7:39 AMnavOptions{}
builder does not seem to work for me when using Navigation Kotlin DSL
I am using it like this
fragment<F>(navRouteInfo.getRoute()) {
with(navRouteInfo) {
destinationLabelId?.let { label = context.getString(it) }
Log.d("CHUI", "route options ${navOptions}")
navOptions?.let {
navOptions {
it.popUpToRoute?.let { route ->
Log.d("CHUI", "popup route $route, inclusive ${it.isPopUpToInclusive()}")
popUpTo(route) {
inclusive = it.isPopUpToInclusive()
}
}
}
}
}
But this does not work but when I try to pass NavOptions
in navigate()
like this it works
navController.navigate("${HomeFragment.NAV_ROUTE_INFO.baseRoute}/false", HomeFragment.NAV_ROUTE_INFO.navOptions)
HomeFragment.NAV_ROUTE_INFO.navOptions is NavOptions only
Any other faced similar problem with Navigation Kotlin DSLRohan Maity
08/11/2022, 8:44 AMnavOptions{}
is not part of Navigation kotlin DSL and does not set anything if you declare it inside the Navigation kotlin dsl fragment just like I did
So you have to pass navOptions navigate()
only