android_catalogue1-4 Exercise 2: Item Count in the Title ========================================================= Simplest: compute it in ListContent, because it is a pure function of state.items: topBar = { TopAppBar(title = { Text("My Catalogue (${state.items.size})") }) }, Where should it come from? Both work, but computing it in the composable is better here: - state.items is already filtered, so items.size is exactly "number currently listed". - Adding a field to ListUiState would duplicate information that can be derived, and two fields that must always agree can drift apart. A reason to put it in the view model instead: a calculation that is expensive or uses data the screen does not have (for example a count across all items while a filter is active; that one is already in state.totalCount).