Android Kotlin Coroutines: what is the difference between flow, callbackFlow, channelFlow,… other flow constructors
For callbackFlow: You cannot use emit() as the simple Flow (because it’s a suspend function) inside a callback. Therefore the callbackFlow offers you a synchronized way to do it with the trySend() option. Example: fun observeData() = flow { myAwesomeInterface.addListener{ result -> emit(result) // NOT ALLOWED } } So, coroutines offer you the option of … Read more