I am using NavController components in a single activity app. Each screen is different fragment. Each main UI flow in the app is separated in different navigation graphs (I do not want to have one big single xml with all the navigations).
However some of the fragments are common between multiple navigation flows. For example I have custom error fragment to show an error and different other fragments can show that error fragment. So this fragment should be accessible from all the navigation graphs. One solution is to add it to each nav graph but this will bloat my xml-s because I have other common fragments and they will be copy-pasted in all the nav graph xml-s which seems bad idea.
Is there any best practice how can solve this issue?
I am considering to add Kotlin extension methods to NavController which will programatically add the common fragments into the current nav graph.