ImageLoader

interface ImageLoader

A service class that loads images by executing ImageRequests. Image loaders handle caching, data fetching, image decoding, request management, memory management, and more.

Image loaders are designed to be shareable and work best when you create a single instance and share it throughout your app.

Types

Builder
Link copied to clipboard
class Builder

Functions

enqueue
Link copied to clipboard
abstract fun enqueue(request: ImageRequest): Disposable
Enqueue the request to be executed asynchronously.
execute
Link copied to clipboard
abstract suspend fun execute(request: ImageRequest): ImageResult
Execute the request in the current coroutine scope.
newBuilder
Link copied to clipboard
abstract fun newBuilder(): ImageLoader.Builder
Create an ImageLoader.Builder that shares the same resources and configuration as this image loader.
shutdown
Link copied to clipboard
abstract fun shutdown()
Cancel any new and in progress requests, clear the MemoryCache, and close any open system resources.

Properties

components
Link copied to clipboard
abstract val components: ComponentRegistry
The components used to fulfil image requests.
defaults
Link copied to clipboard
abstract val defaults: DefaultRequestOptions
The default options that are used to fill in unset ImageRequest values.
diskCache
Link copied to clipboard
abstract val diskCache: DiskCache?
An on-disk cache of previously loaded images.
memoryCache
Link copied to clipboard
abstract val memoryCache: MemoryCache?
An in-memory cache of previously loaded images.

Extensions

executeBlocking
Link copied to clipboard
fun ImageLoader.executeBlocking(request: ImageRequest): ImageResult
Execute the request and block the current thread until it completes.