I want to send a string Arraylist between two compose functions. Each one of those functions are different screens. I tried converting the Arraylist to gson string but got a deep navigation link error.
composable(
route = Screen.ProductPhotos.route+"/{photos}",
arguments = listOf(
navArgument("photos"){
}
)
) {
entry->
ProductPhotos(photos = entry.arguments?.getString("photos")!!)
}
this is for navigation for the composable function ProductPhotos.
.clickable(onClick = {
var connectionsJSONString = Gson().toJson(messagesList[index].images)
connectionsJSONString=Gson().toJson(messagesList[index].images).toString()
navController.navigate(Screen.ProductPhotos.withArgs(
connectionsJSONString
))
}),
this code is inside another composable function and that is where I navigate to the product photos screen
fun withArgs(vararg args: String): String {
return buildString {
append(route)
args.forEach { arg ->
append("/$arg")
Log.d("baga",route)
}
}
}
This is withArgs function. I tried using normal string it works fine it seems the problem that those strings stored in the array are firebase store URL this is an example for the error
java.lang.IllegalArgumentException: Navigation destination that matches request NavDeepLinkRequest{ uri=android-app://androidx.navigation/productPhotos/["https://firebasestorage.googleapis.com/v0/b/products-app-c0516.appspot.com/o/images%2Fc27f0948-d833-4ee1-84e7-1a629bd3f4de.jpg?alt\u003dmedia\u0026token\u003d1d44abe6-f106-4186-8462-ed246636c289"] } cannot be found in the navigation graph NavGraph(0x0) startDestination={Destination(0xfdb9e2f) route=Login_screen}