readBytes method

Future<Uint8List> readBytes()

Reads and buffers the complete response body.

Implementation

Future<Uint8List> readBytes() async {
  final builder = BytesBuilder(copy: false);
  await for (final chunk in body) {
    builder.add(chunk);
  }
  return builder.takeBytes();
}