Kamel-Media / Kamel

Kotlin asynchronous media loading and caching library for Compose.
Apache License 2.0
657 stars 25 forks source link

No static method onDownload(Lio/ktor/client/request/HttpRequestBuilder;Lkotlin/jvm/functions/Function3;)V #114

Open faridsavarudin opened 2 months ago

faridsavarudin commented 2 months ago

using ktor version 3.0.0-beta-2, using kamel version 0.9.5

@Composable fun ImageLoader(url: String, desc: String, modifier: Modifier, contentScale: ContentScale) { val imageResources = LocalImageResource.current

when (val resource = asyncPainterResource(url)) {
    is Resource.Loading -> {
        LoadingScreen()
    }
    is Resource.Success -> {
        val painter: Painter = resource.value
        Image(painter,
            contentDescription = desc,
            modifier = modifier,
            contentScale = contentScale)
    }
    is Resource.Failure -> {
        val fallbackPainter = imageResources.Company()
        Image(fallbackPainter,
            contentDescription = desc,
            modifier = modifier,
            contentScale = ContentScale.FillHeight)
    }
}

}

I always go to Resource.Failure, and got this message error

No static method onDownload(Lio/ktor/client/request/HttpRequestBuilder;Lkotlin/jvm/functions/Function3;)V

luca992 commented 2 months ago

You most likely will have to use the latest beta version if you want to use the beta version of ktor