oday
11/07/2022, 9:07 AMvar location = mutableStateOf<GetLocation.Location?>(null)
var dateRange = mutableStateOf<DateRange?>(null)
var category = mutableStateOf(Category.All)
var period = mutableStateOf(Period.Any)
fun fetchData() {
viewModelScope.launch(<http://dispatchers.io|dispatchers.io>) {
getLocation.execute().fold(
onSuccess = { response ->
withContext(dispatchers.main) {
location.value = response.orNull()
}
},
onFailure = {
logger.log(it)
}
)
.... etc....
but I would like to observe any changes in these fields and fetch again when they’ve been updated
is there like a combineLatest?oday
11/07/2022, 9:14 AModay
11/07/2022, 11:32 AMflowOf(flow1, flow2, flow3, flow4).flattenMerge().collect { actOnIt() }