BaseResponse constructor

BaseResponse(
  1. int statusCode, {
  2. int? contentLength,
  3. BaseRequest? request,
  4. Map<String, String> headers = const {},
  5. bool isRedirect = false,
  6. bool persistentConnection = true,
  7. String? reasonPhrase,
})

Implementation

BaseResponse(this.statusCode,
    {this.contentLength,
    this.request,
    this.headers = const {},
    this.isRedirect = false,
    this.persistentConnection = true,
    this.reasonPhrase}) {
  if (statusCode < 100) {
    throw ArgumentError('Invalid status code $statusCode.');
  } else if (contentLength != null && contentLength! < 0) {
    throw ArgumentError('Invalid content length $contentLength.');
  }
}