Images class
Constructors
- Images({String prefix = 'assets/images/', AssetBundle? bundle})
Properties
- bundle ↔ AssetBundle
-
The AssetBundle from which images are loaded.
defaults to Flame.bundle.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
-
keys
→ List<
String> -
Returns the list of keys in the cache.
no setter
- prefix ↔ String
-
Path prefix to the project's directory with images.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
String name, Image image) → void -
Adds the
image
into the cache under the keyname
. -
addFromBase64Data(
String name, String base64Data) → Future< void> - Transform the base64 encoded image into an Image and adds it into the cache.
-
clear(
String name) → void -
Removes the image
name
from the cache. -
clearCache(
) → void - Removes all cached images.
-
containsKey(
String key) → bool -
Whether the cache contains the specified
key
or not. -
fetchOrGenerate(
String name, Future< Image> imageGenerator()) → Future<Image> -
If the image with
name
exists in the cache that is returned, otherwise the image generated byimageGenerator
is returned. -
findKeyForImage(
Image image) → String? -
fromBase64(
String key, String base64) → Future< Image> -
fromCache(
String name) → Image -
Returns the image
name
from the cache. -
load(
String fileName, {String? key}) → Future< Image> -
Loads the specified image with
fileName
into the cache. By default the key in the cache is thefileName
, if another key is desired, specify the optionalkey
argument. -
loadAll(
List< String> fileNames) → Future<List< Image> > -
Loads all images with the specified
fileNames
into the cache. -
loadAllFromPattern(
Pattern pattern) → Future< List< Image> > - Loads all images in the prefixed path that are matching the specified pattern.
-
loadAllImages(
) → Future< List< Image> > - Loads all images from the specified (or default) prefix into the cache.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
ready(
) → Future< void> - Waits until all currently pending image loading operations complete.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited