copyWith method

ApiConfig copyWith({
  1. String? baseUrl,
  2. String? apiVersion,
  3. Duration? timeout,
  4. Map<String, String>? defaultHeaders,
  5. bool? needTenantByDefault,
})

Returns a new ApiConfig with the provided fields replaced.

Any field left null keeps its current value.

Implementation

ApiConfig copyWith({
  String? baseUrl,
  String? apiVersion,
  Duration? timeout,
  Map<String, String>? defaultHeaders,
  bool? needTenantByDefault,
}) {
  return ApiConfig(
    baseUrl: baseUrl ?? this.baseUrl,
    apiVersion: apiVersion ?? this.apiVersion,
    timeout: timeout ?? this.timeout,
    defaultHeaders: defaultHeaders ?? this.defaultHeaders,
    needTenantByDefault: needTenantByDefault ?? this.needTenantByDefault,
  );
}