Thomas
02/01/2024, 3:36 AMNavController.navigate
inside the popUpTo
function, what's the difference between passing in 1.NavController.graph.findStartDestination().id
and 2.NavController.graph.id
?
I suppose both options points at the root of the NavGraph
? 🤔Ian Lake
02/01/2024, 4:15 AMfindStartDestination
? It explicitly calls out where they are different (when the start destination of your graph is a nested navigation graph itself): https://developer.android.com/reference/kotlin/androidx/navigation/NavGraph#(androidx.navigation.NavGraph).findStartDestination()Thomas
02/01/2024, 6:20 AMfindStartDestination
)
> Finds the actual start destination of the graph, handling cases where the graph's starting destination is itself a NavGraph
Can I understand "actual start destination", as "first non-NavGraph destination"?Thomas
02/01/2024, 9:16 AMstartDestinationId
and findStartDestination().id
Here is a screenshot, I hope this helps people in the futureThomas
02/01/2024, 9:24 AMpopUpTo
with graph.id
kdoc on `NavGraph`:
> A NavGraph serves as a 'virtual' destination: while the NavGraph itself will not appear on the back stack, navigating to the NavGraph will cause the [starting destination]_*[getStartDestination]*_ to be added to the back stack.
I suppose popUpTo
with graph.id
pops the entire back stack, and then adds the start destination to the back stack?
And what happens with inclusive = true
?