Skip to content

Instantly share code, notes, and snippets.

@hiteshchopra11
Created January 16, 2022 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiteshchopra11/b0e195e7ac37f8f8dee5408de32cb40c to your computer and use it in GitHub Desktop.
Save hiteshchopra11/b0e195e7ac37f8f8dee5408de32cb40c to your computer and use it in GitHub Desktop.
suspend fun fetchImages(): Result {
return withContext(Dispatchers.IO) {
try {
val result = ImageService.create().getImages()
Result.SuccessWithData(result)
} catch (exception: Exception) {
Result.Error(exception)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment