byteStream method

  1. @override
Stream<List<int>> byteStream()
override

Returns content body as a single-subscription byte stream.

Implementation

@override
Stream<List<int>> byteStream() {
  try {
    final res = response;
    if (res is http.StreamedResponse) {
      return res.stream;
    } else {
      return http.ByteStream.fromBytes((res as http.Response).bodyBytes);
    }
  } on Exception catch (e) {
    throw ClientException.openingStreamFailed(e);
  }
}