`navOptions{}` builder does not seem to work for ...
# android
r
navOptions{}
builder does not seem to work for me when using Navigation Kotlin DSL I am using it like this
Copy code
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
Copy code
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 DSL
✔️ 1
Found the reason
navOptions{}
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