downloadImage static method

Future<Uint8List> downloadImage(
  1. String url
)

Implementation

static Future<Uint8List> downloadImage(String url) async {
  final response = await http.get(Uri.parse(url));
  if (response.statusCode != 200) {
    throw Exception('Failed to download image (HTTP ${response.statusCode})');
  }
  return response.bodyBytes;
}