https://kotlinlang.org logo
#coroutines
Title
# coroutines
m

Marc Knaup

04/08/2020, 6:28 PM
Does it make sense to define operations like that to make a
Flow
more readable? 🤔 Also, is there a shorter way to “initialize”
distinctUntilChanged
with a value that it doesn’t emit? (I use
.onStart().distinctUntilChanged().drop()
here.)
l

louiscad

04/08/2020, 6:44 PM
Well, if you find a clear enough function signature (which might get some help from named parameter), it's quite easy to write your own doing these, using these operators, or even an optimized, custom implementation with local variables.
👍 1
a

araqnid

04/08/2020, 7:03 PM
if the question is: “does it make sense to write your own extensions to Flow<T> to operate on them” then imho the answer is a resounding “yes”
👍 1
t

tseisel

04/08/2020, 8:18 PM
I find such declarative code particularly elegant to be honest.
a

Alex Gotev

04/08/2020, 8:45 PM
It clearly expresses your intent, reducing the temptation of comments to zero, so YES!!
5 Views