Skip to content

combineAndCollect: combine and collect flows #199

Open
@hoc081098

Description

@hoc081098
public suspend fun <T1, T2> combineAndCollect(
  flow1: Flow<T1>,
  flow2: Flow<T2>,
  collector: suspend (a: T1, b: T2) -> Unit,
)

Example

class MyActivity : AppCompatActivity() {
  fun onCreate(...) {
    lifecycleScope.launch {
      repeatOnLifecycle {
        combineAndCollect(viewModel.uiStateFlow, xxxStateFlow) { uiState, xxx -> renderUi(uiState, xxx) }
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions