ImageRef

sealed interface ImageRef

Where an image comes from. core can't name a platform image type (a Bitmap, a UIImage...) and there is no file path that works everywhere (the web and iOS have none), so an image is either a URL or the raw bytes of an encoded image file.

Inheritors

Types

Link copied to clipboard
class Bytes(val key: String, val data: ByteArray) : ImageRef

The bytes of an encoded image file (PNG, JPEG, ...) — what an app gets from a photo picker, a file, or its own assets on any platform. That makes this the way to use a picture from the user's phone: on Android a picked photo is a content:// address, not a file path, but an app can always read its bytes.

Link copied to clipboard
data class Url(val url: String) : ImageRef

An http/https URL the device can reach; downloaded on demand and cached by URL.