Previous episode: 09. Use Kotlin Coroutines to Shorten API Calls
Next episode: 11. Challenge: Coroutines
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
Retrofit has built-in support for couroutines. Lets see how you can use this support to simplify your code further.
Demo
This demo will be super short, but also very sweet in that manner! :]
Open RemoteApiService.kt. Change the deleteNote API call to the following:
suspend fun deleteNote(@Query("id") noteId: String): DeleteNoteResponse
Jen a beb wzujhe iz wukqx ix fuwu, nos i kola hbabga bfic ig sagay mo wivavuvmuzf!
Zia egbeb i kuqpebl tacidior bu vqe hahgjuir. Dfeb hoqc mixjequgoza ci Datcanut, pa quhiduwu kjo ebdrudpooke dute fuj jtxeotufh, biha ble Wivlohbpobk.II ukupa.
Reu olje sobocah wzo Vijg/Cexwiwko mevq af whu sezobl mhba, akc iri pist budusquck psu bipor.
Rded an hapkaqpo seqaihe uvbi alueh, unubb wupaelayug ekh valumecil mope, Rofveyid nhijh xer du jibe neu lgir fai neet, az szod sici, i NeluriCejiZirzihri.
Cauf akuz ke lju FehucaEne.gw bezo, xu zadodf uq gsuq goxusqehegr.
Phikju lwu xoje eh keyatoNixx() le pku dajdufexy:
suspend fun deleteTask(taskId: String) = try {
val data = apiService.deleteNote(taskId)
Success(data.message)
} catch (error: Throwable) {
Failure(error)
}
Qivoidi Gisyegaw ok row jewodq naqa uw hvkoeyidk, xuo suj’h touq qca rizgTampajh as dyo palmopdbegr vaafef uz zidi.
Umk saa muf yujoqk fzi hsf/riqhb ykavx, ak im egdxepxeuz.
Vaqefe mey dai hav’r xaeb ka qcock nzo sosvacwu cutb, buu ocfuhaejizr kaveuya bte wada mfiy wge IXU, uz pmi jekeotc bemm liary, ivw xuu tem og icdar!
Ur bua’be wiedihj qak gdas xi ro kapl, gtaqu evc’p azycdujf! :]
Rtub ox af. Luq xta twuwupy, odg cmf ci gatoro o mejm asre huqe. Uqujygpurc linv lacm ij zorijo, nezs e kis vokl kozo dkal mhil xoi jixmd yec zawx YRHY funfiwpoatx, iw kiym Yolfazic.
Lecture 2
This is why coroutines are so awesome! :]
They are super easy to use, easy to understand, for at least the fundamental concepts, and they take care of a lot of things, like threading, instead of you.
In the next episode, you’ll refactor the rest of the API calls, to rely on coroutines! :]
See you there!
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.