In my code, I use a coordinator that triggers navigation to a screen when a specific condition is met.
I’m wondering whether this structure is safe:
MyAppNavHost() CoordinatorForceUpdateSheet(navigateToForceUpdate)
Everything seems to work correctly, but I’m worried that in some cases it might throw an exception:
java.lang.IllegalStateException: You must call setGraph() before calling getGraph()
Can I rely on the NavHost graph being attached to the NavController before the coordinator triggers navigation? Or should I explicitly guard against calling navigation before the NavHost is initialized?