'Glance fails to load images using the coil

I did this in Glance to get a bitmap of the online URI for display, but it failed. Does Glance still support weight ratios?

val context = LocalContext.current val imageLoader = ImageLoader(context)
var bitmap = currentState<Bitmap>()

imageLoader.enqueue(
    ImageRequest.Builder(context)
        .data(parcelItem.artUri)
        .error(R.drawable.music)
        .target(
            onSuccess = {
                bitmap = it.toBitmap()
            },
            onError = {
                it?.let {
                    bitmap = it.toBitmap()
                }
            }
        )
        .build()
)
Image(
  provider = ImageProvider(bitmap),
  modifier = GlanceModifier.size(50.dp).cornerRadius(10.dp).padding(8.dp),
  contentDescription = ""
)

It is not possible to use the Coil directly, because the Glance component is required, and the ImageProvider(URI) does not support online resolution.



Solution 1:[1]

I just need to get the Bitmap before the update and pass it to the Widget

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ???