AssetKind<T extends Object> class
abstract
A kind of asset Assets loads, shares and frees, as it does models
and textures: a package's, such as sounds. Load one with
Assets.load; WorldSystems.addAssetKind lets Assets.preload load
it by its extension too. One instance per kind is the rule (a const,
or a static final): a name is loaded as one kind only.
Constructors
- AssetKind()
-
A kind;
const, so one instance can be shared.const
Properties
-
extensions
→ List<
String> -
The ends of the file names it loads, with the dot:
['.wav', '.ogg'].no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- name → String
-
What the kind is called in errors:
sound.no setter - reloads → bool
-
Whether a hot reload reads this kind's files again (reload): false
unless a kind says so.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
free(
World world, T value) → void -
Frees
valuewhen the last object holding it is destroyed, or whenworldis disposed (before its systems are). What it throws is reported to World.errors. -
load(
World world, String name, Uint8List bytes) → Future< T> -
Makes the asset from
bytes, the filename's, forworld. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reload(
World world, String name, T value, Uint8List bytes) → Future< void> -
Puts
bytes, the filename's as it is now, intovalue, which was loaded from it (World.reloadAssets, on a hot reload): a sound whose file was changed plays the new sound. Only for a kind that reloads. What it throws is reported to World.errors, andvaluestays as it was. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited