Images class

Constructors

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
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 key name.
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 by imageGenerator 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, String? package}) → Future<Image>
Loads the image at fileName into the cache.
loadAll(List<String> fileNames) → Future<List<Image>>
Loads all images with the specified fileNames into the cache.
loadAllFromPattern(Pattern pattern, {required String directory}) → Future<List<Image>>
Loads all images under directory that match the specified pattern.
loadAllImages({required String directory}) → Future<List<Image>>
Loads every image found under directory 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

Static Methods

resolvePath(String fileName, String? package) → String
Resolves fileName to the path it is loaded from, and cached under, when it belongs to package.