Unresolved reference: OkHttp in ktor

I am adding OkHttp in HttpClient. But I am getting error. Unresolved reference: OkHttp. I tried to add library in commonMain of build.gradle.kts, but I think I am missing some steps or doing something wrong. I want to use ktor Http but getting weird issue on my side. Can someone guide me, what am I… Read More Unresolved reference: OkHttp in ktor

How to observe Ktor download progress by a Flow

I want to observe the download progress by a Flow, so I wrote a function like this: suspend fun downloadFile(file: File, url: String): Flow<Int>{ val client = HttpClient(Android) return flow{ val httpResponse: HttpResponse = client.get(url) { onDownload { bytesSentTotal, contentLength -> val progress = (bytesSentTotal * 100f / contentLength).roundToInt() emit(progress) } } val responseBody: ByteArray… Read More How to observe Ktor download progress by a Flow