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

halim

08/26/2019, 10:03 AM
hi, i start with corouitnes flow and i am confuse about how flow store data internally :
Copy code
val stream = flow {
     emit(1)
     emit(2)
}
emit(T) method use for send data to flow, but how flow store this data ?
d

diesieben07

08/26/2019, 10:04 AM
Flow does not "store" your data. The lambda you pass to
flow
is stored and called when the flow is collected. each time you call
emit
the lambda is suspended until the collector processes the emitted element.
2 Views