fromHttp static method

Future<SkeletonData> fromHttp(
  1. Atlas atlas,
  2. String skeletonURL
)

Loads a SkeletonData from the URL skeletonURL. Uses the provided atlas to resolve attachment images.

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

Implementation

static Future<SkeletonData> fromHttp(Atlas atlas, String skeletonURL) async {
  if (skeletonURL.endsWith(".json")) {
    return fromJson(atlas, convert.utf8.decode((await http.get(Uri.parse(skeletonURL))).bodyBytes));
  } else {
    return fromBinary(atlas, (await http.get(Uri.parse(skeletonURL))).bodyBytes);
  }
}