TextAssetCache class
Asset cache for text files
- Inheritance
-
- Object
- GenericCache<
String> - AssetCache<
String> - TextAssetCache
Constructors
- TextAssetCache({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<
String> -
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
keyis cachedinherited -
load(
String key) → Future< String> -
Load an asset from the cache or load it from the asset bundle and cache it
inherited
-
loadAsset(
String key) → Future< String> -
Load and decode an asset from a bundle given a
keyinherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
preload(
List< String> keys) → Future<List< String> > -
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 loadinherited -
remove(
String key) → bool -
Remove a specific cached item by
keyReturns true if the item was present and removed, false otherwiseinherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited