copyWith method

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

Create a BaseOptions from current instance with merged attributes.

Implementation

BaseOptions copyWith({
  String? method,
  String? baseUrl,
  Map<String, dynamic>? queryParameters,
  String? path,
  Duration? connectTimeout,
  Duration? receiveTimeout,
  Duration? sendTimeout,
  Map<String, Object?>? extra,
  Map<String, Object?>? headers,
  bool? preserveHeaderCase,
  ResponseType? responseType,
  String? contentType,
  ValidateStatus? validateStatus,
  bool? receiveDataWhenStatusError,
  bool? followRedirects,
  int? maxRedirects,
  bool? persistentConnection,
  RequestEncoder? requestEncoder,
  ResponseDecoder? responseDecoder,
  ListFormat? listFormat,
}) {
  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),
    preserveHeaderCase: preserveHeaderCase ?? this.preserveHeaderCase,
    responseType: responseType ?? this.responseType,
    contentType: contentType ?? this.contentType,
    validateStatus: validateStatus ?? this.validateStatus,
    receiveDataWhenStatusError:
        receiveDataWhenStatusError ?? this.receiveDataWhenStatusError,
    followRedirects: followRedirects ?? this.followRedirects,
    maxRedirects: maxRedirects ?? this.maxRedirects,
    persistentConnection: persistentConnection ?? this.persistentConnection,
    requestEncoder: requestEncoder ?? this.requestEncoder,
    responseDecoder: responseDecoder ?? this.responseDecoder,
    listFormat: listFormat ?? this.listFormat,
  );
}