Skip to content

Instantly share code, notes, and snippets.

@gastsail
Created December 21, 2019 16:10
Show Gist options
  • Select an option

  • Save gastsail/bc5ed73069fae77a6f9bd03aaeda5445 to your computer and use it in GitHub Desktop.

Select an option

Save gastsail/bc5ed73069fae77a6f9bd03aaeda5445 to your computer and use it in GitHub Desktop.
class EventsViewModel(private val useCase: IEvent):ViewModel() {
val fetchEventList = liveData(Dispatchers.IO){
try {
val eventList = useCase.getEvents()
emit(eventList)
}catch (e:Exception){
Crashlytics.logException(e.cause)
emit(Resource.Failure(e.cause!!))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment