Request constructor Null safety

Request(
  1. {required Uri uri,
  2. required String method,
  3. required Map<String, String> headers,
  4. ValidateCallback? validateStatus,
  5. List<int> bodyBytes = const [],
  6. required Duration timeout,
  7. ResponseType responseType = ResponseType.json,
  8. void onDownloadProgress(
    1. int total,
    2. int current
    )?}
)

Implementation

Request({
  required this.uri,
  required this.method,
  required this.headers,
  ValidateCallback? validateStatus,
  this.bodyBytes = const [],
  required this.timeout,
  this.responseType = ResponseType.json,
  this.onDownloadProgress,
}) {
  this.validateStatus =
      validateStatus ?? (status) => status >= 200 && status < 300;
}