Andrew Steinmetz
06/19/2026, 6:33 PMChildren composable. Hope this helps someone and open to feedback!
https://plusmobileapps.com/blog/2026/06/15/letting-a-decompose-bloc-render-itself/Andrew Steinmetz
06/19/2026, 6:34 PMChildren(stack = bloc.routerState) { child ->
when (val instance = child.instance) {
is Child.CookMode -> CookModeScreen(instance.bloc)
is Child.Detail -> RecipeDetailScreen(instance.bloc)
is Child.Edit -> EditRecipeScreen(instance.bloc)
// ...one arm per screen
}
}
Into this:
Children(stack = bloc.routerState) { child ->
child.instance.bloc.Content()
}
By adding a simple interface:
interface ComposeScreen {
@Composable fun Content(modifier: Modifier)
}
Then having each component implement that interface and be the type of the router.Arkadii Ivanov
06/19/2026, 7:15 PMArkadii Ivanov
06/19/2026, 7:16 PM