This is model I am using for navigation in Android Compose
@Serializable
sealed class Routes {
@Serializable
data class Route1() : Routes()
@Serializable
data class Route2(
val nextRoute: Routes,
val backRoute: Routes
) : Routes()
@Serializable
data class Route3() : Routes()
}
unfortunatelly I get error: java.lang.IllegalArgumentException: Route Routes.Route2 could not find any NavType for argument nextRoute of type Routes - typeMap received was {} I have seen some examples of writing a customTypes for serializations - https://medium.com/mercadona-tech/type-safety-in-navigation-compose-23c03e3d74a5 But this is a special case.
It appears nested objects are not supported (yet?), flattening the object to only contain json primitives seems to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With