navigationManager.commands.collectAsState().value.also { command ->
if (command.destination.isNotEmpty()) {
navController.navigate(command.destination)
}
}
Can cause nullpointer exceptions on recomposition because the navgraph is not initialized yet. It shoudl be something like:
LaunchedEffect(navigationManager.commands){
navigationManager.commands.collect{ command ->
if (command.destination.isNotEmpty()) {
navController.navigate(command.destination)
}
}
}
navigationManager.commands.collectAsState().value.also { command ->
if (command.destination.isNotEmpty()) {
navController.navigate(command.destination)
}
}
Can cause nullpointer exceptions on recomposition because the navgraph is not initialized yet. It shoudl be something like:
LaunchedEffect(navigationManager.commands){
navigationManager.commands.collect{ command ->
if (command.destination.isNotEmpty()) {
navController.navigate(command.destination)
}
}
}