Peter Mandeljc
01/19/2023, 2:36 PMjava.lang.IllegalArgumentException: navigation destination files is not a direct child of this NavGraph exception?
If I remove optional arguments, it works ok.
NavHost(
navController = controller,
startDestination = "files"
) {
composable(
route = "files?import_file={import_file}",
arguments = listOf(navArgument("import_file") { defaultValue = false })
) { backStack ->
FilesScreen(
openImportDrawer = backStack.arguments?.getBoolean("import_file") ?: false,
)
}
}Ian Lake
01/19/2023, 4:45 PMstartDestination and the route) need to match character by character, so you need to use startDestination = "files?import_file={import_file}"Peter Mandeljc
01/19/2023, 5:05 PMIan Lake
01/19/2023, 5:10 PMstartDestination is a route pattern, it isn't how you pass arguments (e.g., startDestination = "files?import_file=true" is also not expected to work - to do that, you'd set the defaultValue). There's no plans on changing that