Circusmagnus
11/04/2020, 8:12 AMfun constructFlow() = flow { for(x in channel) emit(x) }
Is there any practical difference between
val someFlow = constructFlow()
and
val someFlow get() = constructFlow()
?
I do realize, that second version will call constructFlow on every access, while first one - only once. But since a flow is only a definition of what should happen after collection - isn`t it always the same?Zach Klippenstein (he/him) [MOD]
11/04/2020, 8:16 AMephemient
11/04/2020, 8:52 AMfun constructFlow: Flow<Int> {
var x = 0
return flow { emit(++x) }
}
then they might behave differently, but in your case it looks like it would have the same effect either wayCircusmagnus
11/04/2020, 12:36 PM