When using callBackflow, what's the correct way of cancellation?
1. Do you close the channel and pass it the exception?
2. Do you cancel the scope and provide a CancellationException?
e
elizarov
06/14/2019, 5:27 AM
Depends on the reason (initiator) of cancellation. The data source would close the channel when the data is over. The data consumer would cancel its scope when it does not want more data.
elizarov
06/14/2019, 5:37 AM
If you are writing a data producer then you close the channel with your exception.