fromAsset static method
Loads a SkeletonData from the file skeletonFile
in the root bundle or the optionally provided bundle
.
Uses the provided atlas
to resolve attachment images.
Throws an Exception in case the skeleton data could not be loaded.
Implementation
static Future<SkeletonData> fromAsset(Atlas atlas, String skeletonFile, {AssetBundle? bundle}) async {
bundle ??= rootBundle;
if (skeletonFile.endsWith(".json")) {
return fromJson(atlas, await bundle.loadString(skeletonFile));
} else {
return fromBinary(atlas, (await bundle.load(skeletonFile)).buffer.asUint8List());
}
}