Order the steps
Order the steps to let Feed open Profile without depending on it.
- In
:app, build the NavHost and pass{ navController.navigate(ProfileRoute(it)) } - Define
@Serializable data class ProfileRoute(val id: String)in:feature:profile:api - Give the Feed screen an
onOpenProfile: (String) -> Unitparameter - Add
fun NavGraphBuilder.profileGraph()in:feature:profile
Choose an answer, then open Show answer below to check it.
Show answer
Answer: B D C A
- Define
@Serializable data class ProfileRoute(val id: String)in:feature:profile:apiThe route is the only shared type. - Add
fun NavGraphBuilder.profileGraph()in:feature:profileThe feature registers its own destinations. - Give the Feed screen an
onOpenProfile: (String) -> Unitparameter Feed knows nothing about navigation. - In
:app, build the NavHost and pass{ navController.navigate(ProfileRoute(it)) }Only the app module wires features together.