, then the IDE will signal an “Inapropiate blocking method call”, even if the called method runs on the IO dispatcher. Example:
Copy code
suspend fun testCall(uri: Uri) {
val image = encodeImageToBase64(uri)
}
@Throws(IOException::class)
private suspend fun encodeImageToBase64(imageUri: Uri): String = withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
// Do something
""
}
(Android Studio 3.6-rc02, kotlin version: 1.3.50/1.3.61)
I am not sure why this warning is shown in such case? Could this be a lint issue or am I missing something?
b
Brandon Trautmann
02/10/2020, 4:37 PM
If it's an Android lint issue, there will be an issue ID along with the warning
🙏 1
👍 2
k
Kroppeb
02/10/2020, 11:09 PM
It's nothing to worry about. It thinks you are calling a java function that would block the thread. The compiler isn't advanced enough yet to see you properly wrapped your call.