merge method
合并两个配置,other 的非 null 字段覆盖当前配置
Implementation
AdapterBaseOptions merge(AdapterBaseOptions? other) {
if (other == null) return this;
return copyWith(
connectTimeout: other.connectTimeout,
clearConnectTimeout: other.connectTimeout == null && connectTimeout != null,
receiveTimeout: other.receiveTimeout,
clearReceiveTimeout: other.receiveTimeout == null && receiveTimeout != null,
sendTimeout: other.sendTimeout,
clearSendTimeout: other.sendTimeout == null && sendTimeout != null,
headers: {...headers, ...other.headers},
contentType: other.contentType,
clearContentType: other.contentType == null && contentType != null,
responseType: other.responseType,
followRedirects: other.followRedirects,
maxRedirects: other.maxRedirects,
validateStatus: other.validateStatus,
clearValidateStatus: other.validateStatus == null && validateStatus != null,
receiveDataWhenStatusError: other.receiveDataWhenStatusError,
extra: {...extra, ...other.extra},
);
}