copyWith method Null safety

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

Create a new copy of request object.

Implementation

Request copyWith({
  Uri? uri,
  Duration? timeout,
  String? method,
  Map<String, String>? headers,
  List<int>? bodyBytes,
  ResponseType? responseType,
  ValidateCallback? validateStatus,
  void Function(int total, int current)? onDownloadProgress,
}) {
  return Request(
    uri: uri ?? this.uri,
    validateStatus: validateStatus ?? this.validateStatus,
    timeout: timeout ?? this.timeout,
    method: method ?? this.method,
    headers: headers ?? this.headers,
    bodyBytes: bodyBytes ?? this.bodyBytes,
    responseType: responseType ?? this.responseType,
    onDownloadProgress: onDownloadProgress ?? this.onDownloadProgress,
  );
}