Skip to content

Instantly share code, notes, and snippets.

@TorkelV
Last active Sep 3, 2021
Embed
What would you like to do?
fun Fragment.navigate(directions: NavDirections) {
val controller = findNavController()
val currentDestination = (controller.currentDestination as? FragmentNavigator.Destination)?.className
?: (controller.currentDestination as? DialogFragmentNavigator.Destination)?.className
if (currentDestination == this.javaClass.name) {
controller.navigate(directions)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment