AssetsCache class

A class that loads, and caches files.

It automatically looks for files in the assets directory.


AssetsCache({String prefix = 'assets/', AssetBundle? bundle})


bundle AssetBundle
The AssetBundle from which assets are loaded. defaults to Flame.bundle.
getter/setter pair
cacheCount int
Returns the number of files in the cache.
no setter
hashCode int
The hash code for this object.
no setterinherited
prefix String
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


clear(String file) → void
Removes the file from the cache.
clearCache() → void
Removes all the files from the cache.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
readBinaryFile(String fileName) Future<Uint8List>
Reads a binary file from assets folder.
readFile(String fileName) Future<String>
Reads a file from assets folder.
readJson(String fileName) Future<Map<String, dynamic>>
Reads a json file from the assets folder.
toString() String
A string representation of this object.


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