https://kotlinlang.org logo
#coroutines
Title
# coroutines
h

Harun

09/19/2018, 9:11 PM
Any resources for implementing coroutines+ retrofit 2 especially when one wants to chain multiple calls
there are a few examples
Also there is Retrofit adapter that allows use Deferred as return type of Retrofit interface methods https://github.com/JakeWharton/retrofit2-kotlin-coroutines-adapter Nio examples there, but you just call
await()
Not sure what you mean about “chain multiple calls”. Just call multiple requests sequentially, one by one? This is default behaviour of coroutines:
Copy code
val user = api.loadUser().await()
val result = api.followUser(user..id).await()
.await()
will suspend until request result
h

Harun

09/20/2018, 5:36 AM
Okay thank you will look at the links you have sent. I appreciate.
About chaining of requests, in your last answer you have already clarified it very well
2 Views