Future<Response> fromStream(StreamedResponse response)

Creates a new HTTP response by waiting for the full body to become available from a StreamedResponse.

Source

static Future<Response> fromStream(StreamedResponse response) {
  return response.stream.toBytes().then((List<int> body) {
    return new Response.bytes(
        body,
        response.statusCode,
        request: response.request,
        headers: response.headers,
        isRedirect: response.isRedirect,
        persistentConnection: response.persistentConnection,
        reasonPhrase: response.reasonPhrase);
  });
}