In the code snippet above, SampleViewModel needs to be shared between screen1 and screen2. With the above approach by passing the same route, screen1 and screen2 gets the same Sampleviewmodel instance. Is it the correct approach.
Indu
04/22/2021, 2:13 AM
In the documentation, I saw this option of passing route to hiltNavGraphViewModel to get the viewmodel instance in a nested graph.
i
Ian Lake
04/22/2021, 2:34 AM
You can use a route of any destination on the back stack, so, yep, this is totally valid, but tightly couples these two destinations together, which may or may not be what you want