Skip to content

Instantly share code, notes, and snippets.

@Wajahat-Jawaid
Created November 7, 2022 07:59
Show Gist options
  • Save Wajahat-Jawaid/d93e3087a802c82d67b11c139af12765 to your computer and use it in GitHub Desktop.
Save Wajahat-Jawaid/d93e3087a802c82d67b11c139af12765 to your computer and use it in GitHub Desktop.
// ...
fun getSubscribersCount(blogUrl: String) = liveData(Dispatchers.IO) {
try {
emit(Resource.success(data = repository.getSubscribersCount(blogUrl)))
} catch (exception: Exception) {
emit(Resource.error(data = null, message = exception.message ?: "Error!!!"))
}
}
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment