navigation can accept a nullable string as parameter. Should we ignore the null argument ?
brabo-hi
01/27/2022, 11:28 PM
Copy code
composable(route = "person/{id}") {
val id = it.arguments?.getString("id") // here i am getting the word `null` as as string instead of String? = null
}
navController.navigate("person/${null}")
i
Ian Lake
01/27/2022, 11:31 PM
If you navigate to
person/null
, you will get the ID of
null
, just like you said it should be; there's no string interpretation being done for path parameters (which are always required parameters). Optional arguments are in the form of query parameters (where what you'd navigate to is