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

mng

11/25/2020, 6:44 PM
Hi everyone, I had a question regarding
suspend functions
vs
Flows
. Assuming I follow a Clean architecture approach for my application, when should i be using
suspend functions
and when should I use
Flows
? Assuming I am only ever handling cold streams of data, when should I use one over the other? Should the presentation layer only be exposed to
Flows
and
suspend functions
be used by data and domain layers? Should the
suspend functions
just be used for “one-off” type functions that need to be done on a separate thread?
m

Marko Novakovic

11/25/2020, 8:01 PM
clean architecture doesn't have anything to do with
suspend fun
or
flow
. use what you need. if you need stream of data and need to transform that data use
flow
if not use
suspend fun
👍 4
don't use
flow
to complicate code when
suspend fun
will do