Response.stream constructor

Response.stream({
  1. int statusCode = 200,
  2. Stream<List<int>>? body,
  3. Map<String, Object>? headers,
  4. bool bufferOutput = true,
})

Create a Response with a stream of bytes.

If bufferOutput is true (the default), streamed responses will be buffered to improve performance. If false, all chunks will be pushed over the wire as they're received. Note that, disabling buffering of the output can result in very poor performance, when writing many small chunks.

See also:

Implementation

Response.stream({
  int statusCode = 200,
  Stream<List<int>>? body,
  Map<String, Object>? headers,
  bool bufferOutput = true,
}) : this._(
        shelf.Response(
          statusCode,
          body: body,
          headers: headers,
          context: !bufferOutput
              ? {Response.shelfBufferOutputContextKey: bufferOutput}
              : null,
        ),
      );