loadAsset static method
Loads the FireAtlas from an asset.
Use encoded
= false to load the asset from a json file.
Implementation
static Future<FireAtlas> loadAsset(
String fileName, {
AssetsCache? assets,
Images? images,
bool encoded = true,
}) async {
final assetsCache = assets ?? Flame.assets;
final FireAtlas atlas;
if (encoded) {
final bytes = await assetsCache.readBinaryFile(fileName);
atlas = FireAtlas.deserializeBytes(bytes);
} else {
final json = await assetsCache.readJson(fileName);
atlas = FireAtlas.deserializeJson(json);
}
await atlas.loadImage(images: images);
return atlas;
}