Tiago Nunes
04/08/2021, 4:35 PMprivate val refreshJob = filterFlow
.onEach { prev, new ->
if(prev.x != new.x) {
updateX()
}
}
.launchIn(viewModelScope)
I know I can separate the filterFlow in multiple flows, which is probably the better way of solving my use case, but I'm still curiousZach Klippenstein (he/him) [MOD]
04/08/2021, 4:36 PMscan
and return the new itemIan Lake
04/08/2021, 4:38 PMTiago Nunes
04/08/2021, 4:41 PMZach Klippenstein (he/him) [MOD]
04/08/2021, 4:44 PMAndy Byrnes
04/08/2021, 4:45 PMforEach
, is map { it.x }.distinctUntilChanged().onEach { updateX() }
not sufficient?Tiago Nunes
04/08/2021, 4:48 PM(*old*: T, *new*: T) -> *Boolean*
lambdaTiago Nunes
04/08/2021, 4:49 PM