asset_cache will load and cache any asset of type
T given a decoder.
I made this since CachingAssetBundle does not cache binary data.
Binary resources (from load) are not cached.
Describe assets in your
assets: - assets/images/ - assets/json/
Create asset cache objects with an optional
basePath to avoid using full asset paths:
final imageCache = ImageAssetCache(basePath: "assets/images/"); final jsonCache = JsonAssetCache(basePath: "assets/json/");
Load and cache assets using
load, which returns a
final image = await imageCache.load('sprite.png') final json = await jsonCache.load('sprite.json')
We include the following
Create a custom asset cache by inheriting from
AssetCache and pass it a
You can also inherit from
GenericCache and override
loadAsset, if you don't want to load from a