StreamedResponse class
An HTTP response where the response body is received asynchronously after the headers have been received.
class StreamedResponse extends BaseResponse {
/// The stream from which the response body data can be read. This should
/// always be a single-subscription stream.
final ByteStream stream;
/// Creates a new streaming response. [stream] should be a single-subscription
/// stream.
StreamedResponse(
Stream<List<int>> stream,
int statusCode,
int contentLength,
{BaseRequest request,
Map<String, String> headers: const {},
bool isRedirect: false,
bool persistentConnection: true,
String reasonPhrase})
: super(
statusCode,
contentLength,
request: request,
headers: headers,
isRedirect: isRedirect,
persistentConnection: persistentConnection,
reasonPhrase: reasonPhrase),
this.stream = toByteStream(stream);
}
Extends
BaseResponse > StreamedResponse
Constructors
new StreamedResponse(Stream<List<int>> stream, int statusCode, int contentLength, {BaseRequest request, Map<String, String> headers: const{}, bool isRedirect: false, bool persistentConnection: true, String reasonPhrase}) #
Creates a new streaming response. stream should be a single-subscription stream.
StreamedResponse(
Stream<List<int>> stream,
int statusCode,
int contentLength,
{BaseRequest request,
Map<String, String> headers: const {},
bool isRedirect: false,
bool persistentConnection: true,
String reasonPhrase})
: super(
statusCode,
contentLength,
request: request,
headers: headers,
isRedirect: isRedirect,
persistentConnection: persistentConnection,
reasonPhrase: reasonPhrase),
this.stream = toByteStream(stream);
Properties
final int contentLength #
inherited from BaseResponse
The size of the response body, in bytes. If the size of the request is not known in advance, this is -1.
final int contentLength
final Map<String, String> headers #
inherited from BaseResponse
The headers for this response.
final Map<String, String> headers
final bool isRedirect #
inherited from BaseResponse
Whether this response is a redirect.
final bool isRedirect
final bool persistentConnection #
inherited from BaseResponse
Whether the server requested that a persistent connection be maintained.
final bool persistentConnection
final String reasonPhrase #
inherited from BaseResponse
The reason phrase associated with the status code.
final String reasonPhrase
final BaseRequest request #
inherited from BaseResponse
The (frozen) request that triggered this response.
final BaseRequest request
final int statusCode #
inherited from BaseResponse
The status code of the response.
final int statusCode
final ByteStream stream #
The stream from which the response body data can be read. This should always be a single-subscription stream.
final ByteStream stream