Skip to main content

Module image_loading

Module image_loading 

Source
Expand description

Images loaded from the network, a file or bytes the app holds, decoded off the UI thread at the size they are drawn, as Compose apps load them with Coil’s AsyncImage.

rememberAsyncImage gives a composable the ImageLoadState of an ImageRequest: Loading until the image is decoded, then Ready or Failed. All images share one ImageLoader: a memory cache bounded by the bytes of its decoded pixels, a disk cache of downloaded files with a size limit, and one download for every request of one image. A request whose composables all left the composition stops its download.

The network goes through local_http_client(), so an app enables the http-native (or web-http) feature as it does for its own requests.

Structs§

ImageCacheLimits
How much the shared ImageLoader keeps.
ImageLoader
Loads, decodes and caches images. A clone is the same loader; image_loader is the one every rememberAsyncImage uses.
ImageRequest
The image to load, and the largest size in pixels it is drawn at.

Enums§

ImageLoadError
Why an image did not load.
ImageLoadState
Where a request is.

Functions§

image_loader
The loader every rememberAsyncImage shares, with the default limits and its disk cache in the application’s cache folder.
rememberAsyncImage
Loads request through image_loader while the caller stays in the composition. The caller reads the returned state, so it recomposes when the image is ready or failed. An image the memory cache holds is Ready in the first composition.