I am trying to perform network operation async in Kotlin
. I read it you can do async using async
function. I am getting below error, can anyone gue
async
is available inside kotlinx.couroutines
Make sure that you added the dependency in your gradle file:
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1'
Also make sure that the async is called on a coroutine scrope such as GlobalScope
.
val deferredResult = GlobalScope.async {
}