Jetpack Compose Navigation — NavTypes :compass: We...
# compose-android
j
Jetpack Compose Navigation — NavTypes 🧭 We have a nested graph with multiple destinations, which by themself share some route arguments. For example:
Info(useCase: UseCase, ...)
Loading(useCase: UseCase, ...)
Success(useCase: UseCase, ..., additionalNotSharedParameter)
(UseCase is an enum in this example) For the time being all our parameters are supported “primitives”. We now started to move the shared parameters in its own data class to make the handling easier:
Info(details: Details(useCase: UseCase, ...))
The details class is serializable on its own. The problem is, now we need to specify a custom NavType for every composable in this graph. Is this kind of nesting an anti-pattern in general, should we just live with the NavType or is there a better solution?
We wanted to embrace composition over inheritance, but with these complications we might build it back to inheritance.