Hello everyone I just want some thoughts on a topi...
# multiplatform
s
Hello everyone I just want some thoughts on a topic, Most of us use navcontroller the Compose Navigation so I am conflicted between two approached like the first approach is just passing the nav controller to the UI screen I mean the @Composable fucntions, and the other way to use lambdas just for the navigation and the navigation is only done in NavHost not any where else pros and cons with the limited knowledge I have is lambdas creates interfaces behind the scenes which take memory and the pro of the second approach is separation of concern like if you want to use the screen at some other place and want to navigate to some other screen for that some use case then rather than changing in the function code. would like to know best practices as these ai tools just hallucinate.
g
What I'm doing is injecting in my ViewModel, a "navigator", a singleton. My ViewModel use this to "emit" a navigation to a destination. My view wrapping the NavHost is observing a StateFlow from this "navigator" and do the navigation.
👍 1