is composable(arguments = listOf(navArgument("itemId") { type = NavType.IntType }), just used for mapping an argument type to something other than a string? I noticed that when my argument is a string and I keep it as a string it still works without specifying arguments.
bryankeltonadams
04/11/2024, 5:12 AM
i.e. this still worked even when arguments were commented out.
fun NavController.navigateToCustomers(customerId: String? = null) {
val route = if (customerId != null) {
"customers?customerId=$customerId"
} else {
"customers"
}
this.navigate(route)
}
StringType is indeed the default type if you specify nothing
👀 1
b
bryankeltonadams
04/11/2024, 7:00 AM
Oh cool, yeah that makes sense. I'm just going to make a good habit out of always specifying the arguments, but yeah I was surprised to see it working without it.
s
Stylianos Gakis
04/11/2024, 7:03 AM
Yeah I would not rely on defaults either. I’d definitely specify the type as well.