Skip to main content

rememberAsyncImage

Function rememberAsyncImage 

Source
pub fn rememberAsyncImage(__arg0: ImageRequest) -> State<ImageLoadState>
Expand description

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.

ⓘ
match rememberAsyncImage(ImageRequest::new(url).max_size(240, 240)).value() {
    ImageLoadState::Ready(bitmap) => Image(BitmapPainter(bitmap), ..),
    ImageLoadState::Loading => Placeholder(),
    ImageLoadState::Failed(_) => BrokenImage(),
}