https://kotlinlang.org logo
Title
j

Jason Ankers

03/16/2021, 3:49 AM
I have two data sources which I want to combine:
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

Natsuki(开元米粉实力代购)

03/23/2021, 3:19 PM
maybe
combine
?