copyWith method

CurlOptions copyWith({
  1. bool? insecure,
  2. bool? compressed,
  3. bool? verbose,
  4. bool? location,
  5. int? maxTime,
  6. List<String>? customOptions,
})

Creates a copy of this object with the given fields replaced with the new values.

This method allows you to create a modified version of the current CurlOptions while keeping unchanged values from the original instance.

Example:

final options = CurlOptions(insecure: true);
final newOptions = options.copyWith(verbose: true);
// newOptions has both insecure: true and verbose: true

Implementation

CurlOptions copyWith({
  bool? insecure,
  bool? compressed,
  bool? verbose,
  bool? location,
  int? maxTime,
  List<String>? customOptions,
}) {
  return CurlOptions(
    insecure: insecure ?? this.insecure,
    compressed: compressed ?? this.compressed,
    verbose: verbose ?? this.verbose,
    location: location ?? this.location,
    maxTime: maxTime ?? this.maxTime,
    customOptions: customOptions ?? this.customOptions,
  );
}