Was curious what we all think of the new type safe navigation with compose navigation and what way you would possibly implement it neatly in code.
I have thought of using a sealed class or probably a similar construct
Copy code
sealed class Screens {
@Serializable
data object Home : Screens()
@Serializable
data object About : Screens()
}
Or would you throw each route definition in separate files, probably where the composable is defined or within their respective packages?
p
Pablichjenkov
05/15/2024, 6:59 PM
The sealed class kind of ties them too much. I would rather have independent class routes. They don't necessarily need to relate to each other.
One also, might want to reuse the same Composable - RouteClass pair in a different graph.
👍 2
➕ 3
r
Rudy Sulley
05/15/2024, 7:28 PM
@Pablichjenkov It does tie them together a lot, true
🙂 1
i
Ian Lake
05/15/2024, 7:52 PM
Yeah, we specifically don't recommend sealed classes for this because it doesn't scale and multi-module support us absolutely critical for anything beyond a simple example