addStream method

  1. @override
Future addStream(
  1. Stream<List<int>> stream
)
override

Adds a stream directly the underlying response.

If this instance has access to a correspondingRequest, then it will attempt to transform the content using at most one of the response encoders.

Implementation

@override
Future addStream(Stream<List<int>> stream) async {
  if (!isOpen && isBuffered) throw ResponseContext.closed();
  // A buffered response is sent as a whole by the driver, so do not send
  // headers now; add() appends to the buffer.
  if (!isBuffered) await _commitOrThrow();
  await stream.forEach(add);
}