replace method

StreamedResponse replace({
  1. Stream<List<int>>? byteStream,
  2. int? status,
  3. String? statusText,
  4. Map<String, String>? headers,
})

Create a new StreamedResponse using all the values from this instance except for the parameters specified.

Implementation

StreamedResponse replace(
    {Stream<List<int>>? byteStream,
    int? status,
    String? statusText,
    Map<String, String>? headers}) {
  status = status ?? this.status;
  statusText = statusText ?? this.statusText;
  headers = headers ?? this.headers;
  if (byteStream == null) {
    return StreamedResponse._(status, statusText, headers, _body);
  } else {
    return StreamedResponse.fromByteStream(
        status, statusText, headers, byteStream);
  }
}