Back to Coil

Image Requests

docs/image_requests.md

3.4.0860 B
Original Source

Image Requests

ImageRequests are value objects that provide all the necessary information for an ImageLoader to load an image. ImageRequests can be created using a builder:

kotlin
val request = ImageRequest.Builder(context)
    .data("https://example.com/image.jpg")
    .crossfade(true)
    .target(imageView)
    .build()

Once you've created a request pass it to an ImageLoader to enqueue/execute it:

kotlin
imageLoader.enqueue(request)

See the API documentation for more information.

!!! Notes In Coil 3.x ImageRequest's platform-specific functions (e.g. ImageRequest.Builder.target(ImageView)) are implemented as extension functions and need to be imported separately.