copyWith method
ApiRequest<ResponseType, InnerType>
copyWith({
- String? method,
- String? path,
- String? dataKey,
- String? paginationKey,
- String? baseUrl,
- bool? hasPagination,
- RetryPolicy? retryPolicy,
- int? timeout,
- bool? override500Error,
- bool? isMultipart,
- Object? body = _unset,
- Map<
String, String> ? headers, - List<
ApiInterceptor> ? interceptors, - Object? error = _unset,
- Object? nestedKey = _unset,
- Map<
String, dynamic> ? query,
Note: interceptors are appended to the existing chain rather than
replacing it, so an interceptor can add another without discarding the
ones already configured on the request.
Implementation
ApiRequest<ResponseType, InnerType> copyWith({
String? method,
String? path,
String? dataKey,
String? paginationKey,
String? baseUrl,
bool? hasPagination,
RetryPolicy? retryPolicy,
int? timeout,
bool? override500Error,
bool? isMultipart,
Object? body = _unset,
Map<String, String>? headers,
List<ApiInterceptor>? interceptors,
Object? error = _unset,
Object? nestedKey = _unset,
Map<String, dynamic>? query,
}) => ApiRequest<ResponseType, InnerType>(
requestId: requestId,
hasPagination: hasPagination ?? this.hasPagination,
headers: headers ?? this.headers,
query: query ?? this.query,
method: method ?? this.method,
dataKey: dataKey ?? this.dataKey,
paginationKey: paginationKey ?? this.paginationKey,
// ignore: deprecated_member_use_from_same_package
nestedKey: identical(nestedKey, _unset)
? this.nestedKey
: nestedKey as String?,
isMultipart: isMultipart ?? this.isMultipart,
path: path ?? this.path,
retryPolicy: retryPolicy ?? this.retryPolicy,
error: identical(error, _unset) ? this.error : error as ErrorDescription?,
timeout: timeout ?? this.timeout,
override500Error: override500Error ?? this.override500Error,
baseUrl: baseUrl ?? this.baseUrl,
interceptors: [...?interceptors, ...this.interceptors],
body: identical(body, _unset) ? this.body : _asBody(body),
);