fromHttp static method

Future<SkeletonDataFlutter> fromHttp(
  1. AtlasFlutter atlasFlutter,
  2. String skeletonURL
)

Loads a SkeletonDataFlutter from the URL skeletonURL. Uses the provided atlasFlutter to resolve attachment images.

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

Implementation

static Future<SkeletonDataFlutter> fromHttp(AtlasFlutter atlasFlutter, String skeletonURL) async {
  return fromMemory(atlasFlutter, skeletonURL, (file) async {
    final response = await http.get(Uri.parse(file));
    if (response.statusCode != 200) {
      throw Exception('Failed to load $file: ${response.statusCode}');
    }
    return response.bodyBytes;
  });
}