ImageAssetCache class

Asset cache for Image assets

Inheritance

Constructors

ImageAssetCache({String? basePath, AssetBundle? assetBundle})

Properties

assetBundle → AssetBundle?
Optional asset bundle
finalinherited
basePath → String?
Optional base path so you don't have to type full path
finalinherited
decoder → AssetDecoder<Image>
Decode asset bytes to type T
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
size → int
Get the number of cached items
no setterinherited

Methods

clear() → void
Clear all cached items
inherited
contains(String key) → bool
Check if an item with the given key is cached
inherited
load(String key) → Future<Image>
Load an asset from the cache or load it from the asset bundle and cache it
inherited
loadAsset(String key) → Future<Image>
Load and decode an asset from a bundle given a key
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
preload(List<String> keys) → Future<List<Image>>
Preload multiple assets concurrently for better performance Returns a Future that completes when all assets are loaded Remember to call WidgetsFlutterBinding.ensureInitialized() before initializing the cache at the start of your app This method will throw a PreLoadingAssetsNotFoundException if any asset fails to load
inherited
remove(String key) → bool
Remove a specific cached item by key Returns true if the item was present and removed, false otherwise
inherited
toString() → String
A string representation of this object.
inherited

Operators

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