val _viewState = MutableStateFlow<ViewState>() val viewState: StateFlow<ViewState> = _viewState private fun addFavorite(item: Item) { ... _viewState.value = ViewState.Favorited(itemViewData) } sealed class ViewState { object Initial : ViewState() data class Initialized( val shopViewData: ShopViewData, val itemViewData: ItemViewData, ) : ViewState() data class Favorited( val itemViewData: ItemViewData, ) : ViewState() } } 27 Activity/FragmentにViewStateを通知するFlow/LiveData UIの状態管理(既存のZOZOTOWN Android)