byteData method

  1. @override
Future<ByteData> byteData([
  1. int start = 0,
  2. int? end
])
override

Reads content body as bytes and returns a future of ByteData.

Optional start and end parameters define a range to be read. It's required that 0 ≤ start ≤ end ≤ contentLength. See also ByteData.sublistView for reference.

Implementation

@override
Future<ByteData> byteData([int start = 0, int? end]) async {
  try {
    return ByteData.sublistView(await file.readAsBytes(), start, end);
  } on Exception catch (e) {
    throw ClientException.readingBytesFailed(e);
  }
}