readBytes method
Sends an HTTP GET request to the specified url
and returns the body as
a Uint8List.
Implementation
@override
Future<Uint8List> readBytes(Uri url, {Map<String, String>? headers}) async {
var response = await get(url, headers: headers);
_checkResponseSuccess(url, response);
Uint8List fold(Uint8List bytes, List<int> chunk) {
bytes.addAll(chunk);
return bytes;
}
return response.read().fold(Uint8List(0), fold);
}