Skip to content

Instantly share code, notes, and snippets.

@pavlospt
Created February 27, 2019 11:39
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 pavlospt/48ce7c0970e76681d33383359b23cc4f to your computer and use it in GitHub Desktop.
Save pavlospt/48ce7c0970e76681d33383359b23cc4f to your computer and use it in GitHub Desktop.
suspend fun <Response> Task<Response>.suspended(): Response = suspendCoroutine { continuation ->
addOnSuccessListener { continuation.resume(it) }
addOnFailureListener { continuation.resumeWithException(it) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment