ImageDecoding enum

Image decoding hints guiding the browser's rendering engine.

Controls the HTML decoding attribute on <img> elements, indicating whether the browser should decode image data synchronously or off the main execution thread.

bloomImage defaults to ImageDecoding.async to prevent main-thread jank and frame drops when large images are decoded during scrolling or active UI animations.

bloomImage(
  src: '/assets/gallery-item.jpg',
  alt: 'Gallery preview',
  decoding: ImageDecoding.async,
);

See also:

  • bloomImage, which defaults to asynchronous decoding.
  • BloomImage, the underlying element descriptor.
Inheritance
Available extensions

Values

async → const ImageDecoding

Decodes the image asynchronously on a background thread to prevent blocking the main rendering thread.

Default setting in Bloom JS Native. Prevents user interface stutter when decoding large raster assets.

const ImageDecoding('async')
sync → const ImageDecoding

Decodes the image synchronously for atomic presentation with surrounding document content.

Can cause frame drops on slow devices if the image file is large.

const ImageDecoding('sync')
auto → const ImageDecoding

Allows the browser to determine the optimal decoding mode dynamically.

const ImageDecoding('auto')

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value String
The raw HTML attribute string value ("async", "sync", or "auto").
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

values → const List<ImageDecoding>
A constant List of the values in this enum, in order of their declaration.