dave08
01/07/2024, 4:06 PMdave08
01/07/2024, 4:15 PMRafael Costa
01/07/2024, 4:45 PMDestinationsNavigator
in your screens.
Since it's an interface, it's inherently decoupled from NavController, so you can safely depend on it.dave08
01/07/2024, 4:47 PMRafael Costa
01/07/2024, 4:48 PMfun interface NavigateUp {
fun invoke()
}
And pass it via dependency(NavigateUp { navController.navigateUp })
Rafael Costa
01/07/2024, 4:50 PMdave08
01/07/2024, 4:54 PMRafael Costa
01/07/2024, 5:55 PMcomposable {}
with official navigation. Meaning, even if you depend on NavController there, it’s not a big deal as long as you also have a more “pure” composable that receives only state and lambdas. You can use this space also to get the ViewModel and collect state from it.
This dual composable setup is very common even without Compose Destinations.