copyWith<T> static method
Implementation
static Response<T> copyWith<T>(
Response response, {
required String message,
T? data,
dynamic error,
dynamic extra,
String? body,
required int statusCode,
Map<String, List<String>>? headers,
}) {
if (response is ResponseCustomError) {
return ResponseCustomError<T>(
message: message,
data: data,
error: error,
body: body,
statusCode: statusCode,
headers: headers,
extra: extra);
}
if (response is ResponseMappingFail) {
return ResponseMappingFail<T>(
message: message, error: error, body: body, statusCode: statusCode, headers: headers, extra: extra);
}
if (response is ResponseNoInternetConnection) {
return ResponseNoInternetConnection<T>(
message: message, error: error, body: body, statusCode: statusCode, headers: headers, extra: extra);
}
if (response is ResponseNoInternetConnection) {
return ResponseNoInternetConnection<T>(
message: message, error: error, body: body, statusCode: statusCode, headers: headers, extra: extra);
}
if (response is ResponseConnectionTimeout) {
return ResponseConnectionTimeout<T>(
message: message, error: error, body: body, statusCode: statusCode, headers: headers, extra: extra);
}
if (response is ResponseCancel) {
return ResponseCancel<T>(
message: message, error: error, body: body, statusCode: statusCode, headers: headers, extra: extra);
}
if (response is ResponseFailedHostLookup) {
return ResponseFailedHostLookup<T>(
message: message, error: error, body: body, statusCode: statusCode, headers: headers, extra: extra);
}
if (response is ResponseUnknownFail) {
return ResponseUnknownFail<T>(
message: message, error: error, body: body, statusCode: statusCode, headers: headers, extra: extra);
}
return Response<T>(
message: message,
data: data,
error: error,
extra: extra,
body: body,
statusCode: statusCode,
headers: headers,
);
}