copyWith method

BaseOptions copyWith({
  1. String? method,
  2. String? baseUrl,
  3. Map<String, dynamic>? queryParameters,
  4. String? path,
  5. int? connectTimeout,
  6. int? receiveTimeout,
  7. int? sendTimeout,
  8. Map<String, dynamic>? extra,
  9. Map<String, dynamic>? headers,
  10. ResponseType? responseType,
  11. String? contentType,
  12. ValidateStatus? validateStatus,
  13. bool? receiveDataWhenStatusError,
  14. bool? followRedirects,
  15. int? maxRedirects,
  16. RequestEncoder? requestEncoder,
  17. ResponseDecoder? responseDecoder,
  18. ListFormat? listFormat,
  19. bool? setRequestContentTypeWhenNoPayload,
})

Create a Option from current instance with merging attributes.

Implementation

BaseOptions copyWith({
  String? method,
  String? baseUrl,
  Map<String, dynamic>? queryParameters,
  String? path,
  int? connectTimeout,
  int? receiveTimeout,
  int? sendTimeout,
  Map<String, dynamic>? extra,
  Map<String, dynamic>? headers,
  ResponseType? responseType,
  String? contentType,
  ValidateStatus? validateStatus,
  bool? receiveDataWhenStatusError,
  bool? followRedirects,
  int? maxRedirects,
  RequestEncoder? requestEncoder,
  ResponseDecoder? responseDecoder,
  ListFormat? listFormat,
  bool? setRequestContentTypeWhenNoPayload,
}) {
  return BaseOptions(
    method: method ?? this.method,
    baseUrl: baseUrl ?? this.baseUrl,
    queryParameters: queryParameters ?? this.queryParameters,
    connectTimeout: connectTimeout ?? this.connectTimeout,
    receiveTimeout: receiveTimeout ?? this.receiveTimeout,
    sendTimeout: sendTimeout ?? this.sendTimeout,
    extra: extra ?? Map.from(this.extra),
    headers: headers ?? Map.from(this.headers),
    responseType: responseType ?? this.responseType,
    contentType: contentType ?? this.contentType,
    validateStatus: validateStatus ?? this.validateStatus,
    receiveDataWhenStatusError:
        receiveDataWhenStatusError ?? this.receiveDataWhenStatusError,
    followRedirects: followRedirects ?? this.followRedirects,
    maxRedirects: maxRedirects ?? this.maxRedirects,
    requestEncoder: requestEncoder ?? this.requestEncoder,
    responseDecoder: responseDecoder ?? this.responseDecoder,
    listFormat: listFormat ?? this.listFormat,
    setRequestContentTypeWhenNoPayload: setRequestContentTypeWhenNoPayload ??
        this.setRequestContentTypeWhenNoPayload,
  );
}