Kotlin Coroutines Wait Multiple / Await All Deferred to Complete

Jul 22, 2019
launch(Dispatchers.Default) {    val d1 = async {        delay(1000)        "result1"    }    val d2 = async {        delay(5000)        "result2"    }    val (r1, r2) = listOf(d1, d2).awaitAll()    Timber.d("r1=$r1, r2=$r2")}

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.