Created
March 21, 2019 14:33
-
-
Save MovileGente/3b049b6606e91e3a8fbe9966604a0fe3 to your computer and use it in GitHub Desktop.
Dissecando coroutines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a keyword `suspend` define uma suspending function | |
suspend fun queryUser(id: Int): User { | |
delay(100) // simulando latência de rede ou outra operação lenta | |
return User(id = id, name = "gente.firme", email = "talentos@movile.com") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment