ImageAndroidRetriever

class ImageAndroidRetriever @Inject constructor(contentResolver: ContentResolver) : ImageRetriever

An implementation of the ImageRetriever interface that utilizes the Android system's ContentResolver to retrieve and process image data from provided URIs. This class operates asynchronously and emits successfully processed images through a returned Flow of Image objects.

Threading Model: This class uses coroutines for asynchronous image retrieval and processing. It's recommended to call the retrieve function from a background coroutine to avoid blocking the main thread.

Assumptions: This class assumes the provided URIs are content URIs (e.g., from the device's media store) and not direct file paths.

Constructors

Link copied to clipboard
@Inject
constructor(contentResolver: ContentResolver)

Functions

Link copied to clipboard
open suspend override fun retrieve(uris: List<String>): Flow<Image>

Uses the Android system (ContentResolver) to asynchronously retrieve and convert a list of URIs into corresponding Image objects. Each successful image conversion will be emitted through the returned Flow of Image.