reactormonk
07/04/2022, 8:35 AMChannel
?Joffrey
07/04/2022, 8:38 AMchannel.send()
is a suspend function, but you're in a regular callback where you can't call it, there is trySendBlocking
for this purpose - that is if your callback expects the work to be done when you return. Oh, and it assumes you're not on Kotlin/JS either. Otherwise you could play with trySend
.Joffrey
07/04/2022, 8:39 AMcallbackFlow { ... }
and turn this API into a Flow
-based API. You will of course have the same channel issue as above, but you'll benefit from the rest of the "infrastructure".reactormonk
07/04/2022, 8:41 AMreactormonk
07/04/2022, 9:13 AMcallbackFlow
works as expected. Nice.