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

Rohan Maity

10/16/2019, 4:17 AM
What is use case of coroutines flow ? What does it provide ?
z

zak.taccardi

10/16/2019, 4:19 AM
Flow<T>
should be used when a class exposes multiple values of
T
so any use case where you would register a listener for multiple emissions,
Flow<T>
should be used
if it’s a single asynchronous value, then
suspend () -> T
is the proper type
r

Rohan Maity

10/16/2019, 4:24 AM
Any example for multiple emissions ? In respect to Android would be much better 😅
g

gildor

10/16/2019, 4:44 AM
On Android it may be every callback-based API, you can convert onClickListener events to flow and any other View event, BroadcastReceiver.onReceive and many other
The same as RxJava and similar to LiveData
s

streetsofboston

10/16/2019, 12:11 PM
A Flow is reactive and it will, when active, emit objects/data over time. Like Andrey said, Flow is similar to a cold observable in Rx (Java).
r

Rohan Maity

10/16/2019, 12:21 PM
Cool I get it now .
I would try to convert onClicklisteners to flow
4 Views