bytes property

  1. @override
Future<Uint8List> bytes
override

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

Implementation

@override
Future<Uint8List> get bytes async {
  try {
    final res = response;
    if (res is http.StreamedResponse) {
      return await res.stream.toBytes();
    } else {
      return (res as http.Response).bodyBytes;
    }
  } on Exception catch (e) {
    throw ClientException.readingBytesFailed(e);
  }
}