It’s not the cleanest code, but it works fine in general, and it saves you from dealing with that annoying null initial value for the state variable, right? Well, not so fast!
I’ve seen cases where code like this can result in that flow never getting new states, so, after that initial return, we never get a proper value to actually draw the screen we want. Even worse, after a configuration change, if anything tries to interact with the navController and that return triggers beforehand, it may lead to a crash, since its navGraph never got set by the NavHost .
Now, let’s move to a more subtle situation where I had issues with returns:
@Composable