Was curious what we all think of the new type safe...
# android-architecture
r
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()
}
Copy code
fun NavGraphBuilder.aboutScreen(
    modifier: Modifier = Modifier,
    onBackButtonClick: () -> Unit,
) {
    composable<Screens.About> {
        AboutScreen(
            modifier = modifier,
            onBackButtonClick = onBackButtonClick,
        )
    }
}
Or would you throw each route definition in separate files, probably where the composable is defined or within their respective packages? Slack Conversation