fromFile static method

Future<SkeletonData> fromFile(
  1. Atlas atlas,
  2. String skeletonFile
)

Loads a SkeletonData from the file skeletonFile. Uses the provided atlas to resolve attachment images.

Throws an Exception in case the skeleton data could not be loaded.

Implementation

static Future<SkeletonData> fromFile(Atlas atlas, String skeletonFile) async {
  if (skeletonFile.endsWith(".json")) {
    return fromJson(atlas, convert.utf8.decode(await File(skeletonFile).readAsBytes()));
  } else {
    return fromBinary(atlas, await File(skeletonFile).readAsBytes());
  }
}