title: How to collect multiple state flow in Android
body: <p>How to collect two state flow in activity? Because mine only the first flow that consumed.</p>
  <p>For example, inside viewmodel is like this:</p>
  <pre><code>class ExampleViewModel: ViewModel(){
      private val state = MutableStateFlow&lt;HomeMainFragmentState&gt;(HomeMainFragmentState.Init)
      private val products = MutableStateFlow&lt;List&lt;ProductEntity&gt;&gt;(mutableListOf())
  
  
      //to be consumed
      fun getState() : StateFlow&lt;HomeMainFragmentState&gt; = state
      fun getProducts() : StateFlow&lt;List&lt;ProductEntity&gt;&gt; = products
  }
  </code></pre>
  <p>And then in my view is like this:</p>
  <pre><code>private fun observe(){
        viewLifecycleOwner.lifecycleScope.launch {
        viewLifecycleOwner.lifecycle.repeatOnLifecycle(Lifecycle.State.STARTED){
              viewModel.getState().collect { state -&gt; handleState(state) }
              viewModel.getProducts().collect{ products -&gt; handleProducts(products) }
          }
      }
  }
  </code></pre>
  <p>The problem is, <strong>only the first flow is consumed, for this case is the 'state'</strong>, the <strong>products</strong> was never consumed/executed by activity/fragment.</p>
  <p>How to fix this?
  I also read about combining the flow, does it mean the second flow depends on first flow to run?</p>