ImageSource class abstract

Source for an Image widget. Provides decoded pixels and caches decoding.

Decoding happens synchronously on the first decode call, normally when an Image mounts — fine for bundled assets and config-driven previews; not for HTTP/large-PNG cases (decode upstream and pass via ImageSource.decoded instead).

Constructors

ImageSource.bytes(Uint8List bytes)
Backed by an in-memory byte buffer (PNG / JPEG / BMP / TIFF / GIF — whatever package:image recognizes).
factory
ImageSource.decoded(Image image, {Uint8List? encodedPng})
An already-decoded image (e.g. produced by img.decodePng). Use this when the caller manages decoding (HTTP, large files, transformations).
factory
ImageSource.file(String path)
Backed by a file on disk. On a cache miss, read synchronously during the first decode.
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

decode() → Image
Decoded pixel data. Implementations cache.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

evictAll() → void
Drop every cached file decode. Useful in long-running sessions where assets get hot-swapped underneath.
evictFile(String path) → void
Drop the cached decode for path. Call after writing to the file to force the next decode to re-read from disk.