https://kotlinlang.org logo
#compose
Title
# compose
n

nuhkoca

08/22/2022, 8:06 AM
Hello, I need to set
startDestination
dynamically based on a flag. However,
btAppGraph
doesn’t recompose it after the initial value. How do I do it?
Copy code
val isManager by viewModel.isManager.collectAsStateWithLifecycle()

private fun NavGraphBuilder.btAppGraph(
    appState: BTAppState,
    isManager: Boolean
) {
    ...
    navigation(
        route = Screen.Home.route,
        startDestination = if (isManager) HomeSections.TaskApproval.route else HomeSections.Tasks.route
    ) {
        addHomeGraph(appState)
    }
}
r

Rick Regan

08/22/2022, 7:17 PM
This might be related to a question (also unanswered) that I asked recently, so I figured I’d point it out in case it helps you in some way: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1660238432465599
6 Views