0

I am trying to combine two flows and then send the value to a function and then collect the result.

My code never goes to second line of combine and never comes to collect results block.

What am I missing can anyone pls explain.

Below is my code:

viewModelScope.launch {

            combine(flow1, flow2){ model1: Model1, model2: Model2 ->
                performAction(model1, model2)
            }.collect {list ->
                updateState {
                    copy(isLoading = false, list = list)
                }
            }
        }

Code never goes into performAction function and progress keeps loading.

Please help

keshav kowshik
  • 2,354
  • 4
  • 22
  • 45

1 Answers1

2

I'd suspect that one of your flows is actually empty.

Could you ensure that both of them are emitting values?

Róbert Nagy
  • 6,720
  • 26
  • 45