streamSend method

  1. @override
Future<StreamedResponse> streamSend(
  1. String? method, {
  2. dynamic body,
  3. Map<String, String>? headers,
  4. Uri? uri,
})
inherited

Send an HTTP request with a custom method. The response will be streamed, meaning the body will be available asynchronously. This is useful for large response bodies or for proxies.

If uri is given, the request will be sent to that exact uri. If uri is null, the uri on the BaseRequest will be used (and is thus required).

If headers are given, they will be merged with the set of headers already defined on the BaseRequest.

If body is given, it must be of valid type for the type of request being sent. For example, if sending a JSON request using the JsonRequest, body must be a JSON-encodable Map or List.

Implementation

@override
Future<StreamedResponse> streamSend(String? method,
    {dynamic body, Map<String, String>? headers, Uri? uri}) async {
  final response = await _send(method,
      body: body, headers: headers, streamResponse: true, uri: uri);
  assert(response is StreamedResponse,
      'streamSend() should return a StreamedResponse');
  return response as StreamedResponse;
}