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 value when the last object holding it is destroyed, or when world is 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 file name's, for world.
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 file name's as it is now, into value, 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, and value stays as it was.
toString() → String
A string representation of this object.
inherited

Operators

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