AudioSource class sealed

One declared audio origin, identified before it is decoded.

An AudioSource is kept deliberately separate from MediaSource: audio is decoded to PCM and mixed in the encoder, not loaded as image bytes, so widening MediaSource would break every switch over it. Audio exposes one through audioSource, the collect pass gathers it, the MediaResolver validates + allowlists + materializes it before frame 0, and the encoder -is the materialized file.

Each variant exposes a stable cacheKey — the FNV-1a-64 hash of a canonical string that distinguishes every variant and its discriminating field (path vs host) — so an identical declaration shares one cache entry while a different file or host is a distinct one. It carries only Dart-core types, so it satisfies the layering law and lives in core.

Audio and MediaResolver are named in prose, not as doc links, because they live in layers above core and a link would invert the layering.

Annotations

Constructors

AudioSource.asset(String name)
A bundled asset addressed by its bundle key name (for example audio/song.mp3).
const
factory
AudioSource.file(String path)
A file on disk at the absolute or working-directory-relative path.
const
factory
AudioSource.network(Uri url)
A remote asset at url; only allowlisted hosts and schemes are fetched.
const
factory

Properties

cacheKey String
The path-safe content-hash key for the audio cache.
no setter
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