I am using Android Navigation Component to navigate between fragment screens.
After navigating to a new fragment screen, I want to unregister all the LiveData observations that I registered using the fragment life cycle. The problem is that the fragment is not getting detached until the navigation is complete and I am getting unintended events from LiveData.
How to handle this?
I tried using app:popUpTo but that happens too late.
Any ideas on how to solve this?