Skip to content

Instantly share code, notes, and snippets.

@cmorigaki
Last active September 3, 2020 11:40
Show Gist options
  • Select an option

  • Save cmorigaki/8784367c8b4cf9574d6c8f8a158ad9ca to your computer and use it in GitHub Desktop.

Select an option

Save cmorigaki/8784367c8b4cf9574d6c8f8a158ad9ca to your computer and use it in GitHub Desktop.
Replace SingleLiveEvent with Channel - ViewModel
class MyViewModel : ViewModel() {
protected val actionSender = BroadcastChannel<Action>(Channel.BUFFERED)
val actionReceiver = actionSender.asFlow()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment