https://kotlinlang.org logo
Title
i

itnoles

10/28/2019, 8:13 PM
Should I use Coroutines or Flow for Twitter4j?
🤔 3
e

elizarov

10/28/2019, 8:17 PM
3
🔥 2
👍🏻 1
i

itnoles

10/28/2019, 8:18 PM
Interesting
g

gildor

10/29/2019, 12:17 AM
Flow also based on coroutines, there is no real separation, it is one of APIs of kotlinx.coroutines. You are probably talking about suspend functions Flow represents a stream of events (from 0 to infinity) Suspend function and coroutines builders like runBlocking and launch is one time event and work as any other function So suspend functions work perfectly as API for asynchronous requests (like network, DB etc) and Flow perfect for listening events (notifications, events from user other service etc)