Is there a way I can observe when a new destinatio...
# compose
j
Is there a way I can observe when a new destination is pushed into the backstack using
NavHostController
? My use case is I want to send analytics events when the navigation is “forward” but not “backwards”, so going back to previous screens shouldn’t trigger additional events, which is why I don’t think
OnDestinationChangedListener
could be useful
l
I guess a simple solution would be to either: • remember previous backstack size and if the new one is bigger, send analytics • Send it on viewModel init (provided that each screen has its own unique VM)