downloadImage method
Downloads an image from a given URL.
Parameters:
url: The URL of the image to download
Returns the downloaded image data as bytes.
Implementation
Future<List<int>> downloadImage(String url) async {
final response = await http.get(Uri.parse(url));
if (response.statusCode == 200) {
return response.bodyBytes;
} else {
throw Exception('Failed to download image: ${response.statusCode}');
}
}