kotlinx.coroutines.Deferred result.
Functions that use Deferred as return type should have a name with suffix Async.
Otherwise, it's recommended to turn a function into a suspend one and unwrap Deferred inside it.
Example:
fun calcEverything(): Deferred<Int> {
return CompletableDeferred(42)
}
After the fix applied (add the Async suffix):
fun calcEverythingAsync(): Deferred<Int> {
return CompletableDeferred(42)
}
After the fix applied (turn the function into a suspend one):
suspend fun calcEverything(): Int {
return CompletableDeferred(42).await()
}