downloadImage method
Implementation
@override
Future<Uint8List> downloadImage(String url) async {
final request = BeagleRequest(url);
final response = await httpClient.sendRequest(request);
if (response.status != HttpStatus.ok) {
throw BeagleImageDownloaderException(statusCode: response.status, url: request.url);
}
final bytes = response.bodyBytes;
if (bytes.lengthInBytes == 0) {
throw Exception('Image is an empty file: $url');
}
return bytes;
}