MediaSource class sealed
One declared piece of media, identified before it is resolved.
A MediaSource is the single key shared by Image, Clip, and
Background.image/.video: the collect pass gathers it from the widget
tree, the MediaResolver pre-resolves it to bytes, and paint reads the
cached result back by it. It carries only dart:typed_data and Dart-core
types, so it satisfies the layering law and lives in core (no IO, no
riverpod).
Image, Clip and MediaResolver are named in prose, not as doc links,
because they live in layers above core and would invert the layering.
The four variants cover the four honest origins: a bundled MediaSource.asset, an on-disk MediaSource.file, a MediaSource.network URL, and verbatim MediaSource.memory bytes. They are value-equal so the cache deduplicates identical declarations; memory is equal by the identity of its byte buffer (plus label), because two distinct buffers with the same contents are two distinct loads.
- Implementers
- Annotations
Constructors
- MediaSource.asset(String name)
-
A bundled asset addressed by its bundle key
name(for examplefixtures/swatch.png).constfactory - MediaSource.file(String path)
-
A file on disk at the absolute or working-directory-relative
path.constfactory - MediaSource.memory(Uint8List bytes, {String? debugLabel})
-
Verbatim
bytesalready in memory;debugLabelnames it in errors andtoString. Equality is by the identity ofbytesplusdebugLabel.constfactory - MediaSource.network(Uri url)
-
A remote asset at
url; only allowlisted hosts and schemes are fetched.constfactory
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
-
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