To add androidx navigation bindings, import corbind-navigation module:
dependencies {
implementation("ru.ldralighieri.corbind:corbind-navigation:1.12.1")
}| Component | Extension | Description |
|---|---|---|
| NavController | destinationChanges |
Called when the NavController destination or its arguments change. |
destinationChangeEvents |
A more advanced version of the destinationChanges. |
navController.destinationChanges() // Flow<NavDestination>
.onEach { destination ->
if (destination.id == R.id.fragment_dashboard) {
hideSoftInput()
}
}
.flowWithLifecycle(lifecycle)
.launchIn(lifecycleScope) // lifecycle-runtime-ktxMore examples in source code