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

Orhan Tozan

10/27/2020, 8:57 AM
When using
BroadcastChannel
in ViewModel in order to send events, I was using the non suspend channel.offer(..) to send them, but now with SharedFlow, there seems only be the suspending
emit(...)
method. Does that mean all BroadcastChannel usage's can be migrated from
Copy code
events.offer(...)
to Sharedflow?
Copy code
viewModelScope.launch {
    events.emit(...)
}
If so, that looks like more boilerplate for simple events sending 😕
b

bezrukov

10/27/2020, 9:00 AM
MutableSharedFlow has
tryEmit
, it's pretty the same as Channel's
offer
👍 3
3 Views