Is there a way to get all the previous destinations before the current destination?

Viewed 67

So we can get the destination before the current destination by using NavController.previousBackStackEntry, but I would like to get all the destinations that came before the current destination not just the one before in jetpack compose

1 Answers

You just need to iterate over the backQueue property.

navController.backQueue.forEach { entry ->
    Log.d("TAG", "${entry.destination.route}")
}
Related