Colton Idle
04/25/2023, 4:00 PM/dogdetails/{dogId}
but now I need to update it to take in a list/array of dogIds. It'll typically be 1 id, but can support 2+. I saw the docs talk about adding a list in another section of navigation, but it looks like all I'd need is NavType.IntArrayType, but I'm not sure how to create the string path. Do I just take my array and call tostring on it and compose nav knows how to handle it?
Edit: Looks like no matter what I try to get IntArray working, I just keep getting a
java.lang.UnsupportedOperationException: Arrays don't support default values.
Ian Lake
04/25/2023, 5:15 PM•So you'd be able to writenow supports default values for arrays, which allows support for repeated query params that will map to the argument's array type.NavDeepLink
also now includes a default method which can be overridden to combine two parsed values. (Id68c3, b/209977108)NavType
/dogDetails?dogId={dogId}
and include multiple ids when you navigate e.g., dogDetails?dogId=47&dogId=74&dogId=12
Colton Idle
04/25/2023, 5:22 PMcomposable("dogs/{dogIds}",
arguments = listOf(navArgument("dogIds") {
defaultValue = intArrayOf(1)
type = NavType.IntArrayType }))
{ DogPage(it.arguments?.getIntArray("dogIds")!!)
}
Ian Lake
04/25/2023, 5:24 PMNavType
that parses the string dogdetails/47_74_12
or dogdetails/[47,74,12]
into an array, but you need to define what that parsing istoString
an arrayColton Idle
04/25/2023, 5:25 PMIan Lake
04/25/2023, 5:25 PMdogDetails?dogId={dogId}
, you can certainly use type = NavType.IntArrayType
directlyColton Idle
04/25/2023, 5:25 PMrepeat(backQueue.size) { popBackStack() }
im assuming thats... not great? 🙈Ian Lake
04/25/2023, 6:36 PMColton Idle
04/25/2023, 6:59 PMpopBackStack(StartDestination.route, true)
val dogIdArray = intArrayOf(2)
HomeScreen(
{ navController.navigate("dogDetail?dogIds=$dogIdArray")
Ian Lake
04/25/2023, 10:49 PMinclude multiple ids when you navigate e.g.,dogDetails?dogId=47&dogId=74&dogId=12
Colton Idle
04/25/2023, 11:06 PMdogId=47&dogId=74&dogId=12
etc ?dewildte
04/26/2023, 4:38 PM