loadAsBitmap

suspend fun loadAsBitmap(context: Context, data: Any?, onSuccess: (request: ImageRequest, metadata: ImageResult.Metadata) -> Unit = { _, _ -> }, onError: (request: ImageRequest, throwable: Throwable) -> Unit = { _, _ -> }): Bitmap?

Request an image data and loads it as a Bitmap in a suspending operation.

If you're using your own CDN, you can set the AvatarCoil.imageHeadersProvider to load image data.

Return

The loaded bitmap or null if the loading failed (e.g. network issues).

Parameters

context

A context to build ImageRequest.

data

An image data.

onSuccess

A lambda function will be executed when loading succeeds.

onError

A lambda function will be executed when loading failed.