I have two data sources which I want to combine: `...
# flow
j
I have two data sources which I want to combine:
Copy code
private val workouts = flow { emit(userRepository.getWorkouts()) }
private val exercises = flow { emit(userRepository.getExercises()) }

val workoutsByExerciseId: Flow<Map<String, Workout>> = ? // do some transformation which combines both sources
I want to create
workoutsByExerciseId
which should depend on both
workouts
and
exercises
. If either source changes,
workoutsByExerciseId
should always re-emit with the latest data. Which flow operator do I need here?
n
maybe
combine
?