downloadImage

suspend fun downloadImage(context: Context, uri: Uri, targetView: ImageView?): Result<Drawable>

A suspend function to get the Drawable from the provided uri. The optional targetView is used to determine the expected Drawable size which fits the targetView. When the downloading success, it returns a Result.success and a Result.failure when the downloading fails.

NOTE: It is the client's responsibility to make sure the uri is secure and trusted.