Dominaezzz
10/16/2019, 10:51 AMonStart and onCompletion of a Flow. (Basically open a resource in onStart and close it in onCompletion) What's the most idiomatic way besides reinventing the wheel?gildor
10/16/2019, 12:21 PMflow {} blockelizarov
10/16/2019, 1:10 PMfun <T> Flow<T>.myOperator() = flow {
try {
openResource()
emitAll(this@myOperator)
} finally {
closeResource()
}
}bnn
10/17/2019, 1:05 AMchannelFlow ?bnn
10/17/2019, 1:08 AMchannelFlow {} block and closing it in awaitClose {})bnn
10/17/2019, 1:14 AMgildor
10/17/2019, 1:39 AMawaitClose tho of course useful, but actual implementation depends on what is happening after onStartbnn
10/17/2019, 2:45 PM