Skip to content

Instantly share code, notes, and snippets.

@Kashif-E
Last active March 5, 2022 15:35
Show Gist options
  • Save Kashif-E/d5c90ca04574945f808121aff1612dfb to your computer and use it in GitHub Desktop.
Save Kashif-E/d5c90ca04574945f808121aff1612dfb to your computer and use it in GitHub Desktop.
Parallel API calls With HOF part 2
class repository{
fun getItems( ) {
try {
CoroutineScope(Dispatchers.IO).launch {
val humanResponse = async {
apiService.getHumans()
}
val reptileResponse = async {
apiServices.getReptiles()
}
val birdResponse = async {
apiServices.getBirds(
)
}
}
} catch (e: Exception) {
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment