BloomResponse.stream constructor
BloomResponse.stream(})
Creates a streaming response whose body is written incrementally from body.
Use for large payloads, Server-Sent Events, proxied upstreams, and any response
whose length is not known in advance. Omits content-length so the response
is transmitted using HTTP chunked transfer encoding.
If contentType is provided, it is added to headers.
Example
BloomResponse.stream(
byteStream,
contentType: 'application/octet-stream',
);
Implementation
BloomResponse.stream(
Stream<List<int>> body, {
this.statusCode = 200,
Map<String, String>? headers,
String? contentType,
}) : headers = {
if (contentType != null) 'content-type': contentType,
...?headers,
},
body = Uint8List(0),
_bodyStream = body;