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

Vsevolod Kaganovych

03/01/2020, 8:41 AM
Guys. My question is about Clean Architecture and Flow. How we used it with
RxJava
perviously: presentation layer knows nothing about
RxJava
, we only pass callback from
UseCases
with Success or Error. But now we switch to
Flow
a here’s what I need to understand: I don’t want a
ViewModel
to know anything about the
Flow
, so I pass a
job
to a
ViewModel
to unsubscribe from it and callbacks according to state and use
mainScope()
function in every
UseCase
, so I don’t use a
ViewModelScope
. I need to know your thoughts about it. By doing this I’m sure that if I need to switch in future to other framework than
coroutines flow
I would do it pretty smoothly.
d

Dico

03/02/2020, 1:22 AM
It's a tradeoff - slightly easier ability to change the library vs. Using flow patterns in the presentation layer. Why is it that you can't "commit" to using flow here though? What is the likelihood you'll want to stop using it?
2 Views