You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @raamcosta we a using destination in out project. I want navigate from module a to module b with arguments as argument I want to use data class. I have created my own NavTypeSerializer like documentation but method toRouteString doesn't call. Here a simple example.
This is my screen in module b
// this is exmaple how I am navigating from module a to module b
onNotificationClick
{
val data = Things("Detail","items")
navigator.navigate("test_screen/$data")
},
Here is custom type serializer
@NavTypeSerializer
class ThingsNavTypeSerializer : DestinationsNavTypeSerializer<Things> {
override fun toRouteString(value: Things): String {
return "${value.first};${value.second}"
}
override fun fromRouteString(routeStr: String): Things {
val things = routeStr.split(";")
Log.d("TESTING",things.toString())
//[Things(first=Detail, second=items)]
return Things(first = things[0])
}
}
**But method toRouteString() doesn't call and on method fromRouteString we are need to list of string but it retuns list of things in string format look like this //[Things(first=Detail, second=items)] can you check what is wrong or what I did wrong thanks you
The text was updated successfully, but these errors were encountered:
Check my other answer, make sure you read through the documentation. It will tell you how to expose destinations from other modules, import them in your DestiantionsNavHost module. Then you'll be able to navigate to them.
Hi @raamcosta we a using destination in out project. I want navigate from module a to module b with arguments as argument I want to use data class. I have created my own NavTypeSerializer like documentation but method toRouteString doesn't call. Here a simple example.
This is my screen in module b
@destination()
@composable
fun TestScreen(things: Things) {
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center){
Text(text = things.first, style = MaterialTheme.typography.headlineMedium)
}
}
// this is exmaple how I am navigating from module a to module b
onNotificationClick
{
val data = Things("Detail","items")
navigator.navigate("test_screen/$data")
},
Here is custom type serializer
**But method toRouteString() doesn't call and on method fromRouteString we are need to list of string but it retuns list of things in string format look like this //[Things(first=Detail, second=items)] can you check what is wrong or what I did wrong thanks you
The text was updated successfully, but these errors were encountered: