copyWith method
SmartRequest<T>
copyWith({
- String? path,
- HttpMethod? method,
- dynamic data,
- Map<
String, dynamic> ? queryParameters, - Map<
String, String> ? headers, - Duration? timeout,
- CancelToken? cancelToken,
- bool? isFormData,
- JsonDecoder<
T> ? fromJson, - BytesDecoder<
T> ? fromBytes, - RawResponseDecoder<
T> ? fromResponse, - List<
SmartPlugin> ? extraPlugins, - Set<
Type> ? excludePlugins, - Map<
Type, Set< ? skipHooks,LifecycleHook> > - Set<
String> ? consumedErrorCodes, - BaseOptions? optionsOverride,
- CacheOptions? cacheOptions,
- OnStart? onStart,
- OnSuccess<
T> ? onSuccess, - OnError? onError,
- OnFinish<
T> ? onFinish, - ErrorMessageBuilder? errorMessageBuilder,
- String? successMessage,
- SuccessMessageBuilder<
T> ? successMessageBuilder,
复制并修改请求
Implementation
SmartRequest<T> copyWith({
String? path,
HttpMethod? method,
dynamic data,
Map<String, dynamic>? queryParameters,
Map<String, String>? headers,
Duration? timeout,
CancelToken? cancelToken,
bool? isFormData,
JsonDecoder<T>? fromJson,
BytesDecoder<T>? fromBytes,
RawResponseDecoder<T>? fromResponse,
List<SmartPlugin>? extraPlugins,
Set<Type>? excludePlugins,
Map<Type, Set<LifecycleHook>>? skipHooks,
Set<String>? consumedErrorCodes,
BaseOptions? optionsOverride,
CacheOptions? cacheOptions,
OnStart? onStart,
OnSuccess<T>? onSuccess,
OnError? onError,
OnFinish<T>? onFinish,
ErrorMessageBuilder? errorMessageBuilder,
String? successMessage,
SuccessMessageBuilder<T>? successMessageBuilder,
}) {
return SmartRequest<T>(
path: path ?? this.path,
method: method ?? this.method,
data: data ?? this.data,
queryParameters: queryParameters ?? this.queryParameters,
headers: headers ?? this.headers,
timeout: timeout ?? this.timeout,
cancelToken: cancelToken ?? this.cancelToken,
isFormData: isFormData ?? this.isFormData,
fromJson: fromJson ?? this.fromJson,
fromBytes: fromBytes ?? this.fromBytes,
fromResponse: fromResponse ?? this.fromResponse,
extraPlugins: extraPlugins ?? this.extraPlugins,
excludePlugins: excludePlugins ?? this.excludePlugins,
skipHooks: skipHooks ?? this.skipHooks,
consumedErrorCodes: consumedErrorCodes ?? this.consumedErrorCodes,
optionsOverride: optionsOverride ?? this.optionsOverride,
cacheOptions: cacheOptions ?? this.cacheOptions,
onStart: onStart ?? this.onStart,
onSuccess: onSuccess ?? this.onSuccess,
onError: onError ?? this.onError,
onFinish: onFinish ?? this.onFinish,
errorMessageBuilder: errorMessageBuilder ?? this.errorMessageBuilder,
successMessage: successMessage ?? this.successMessage,
successMessageBuilder:
successMessageBuilder ?? this.successMessageBuilder,
);
}