copy method
Response<T>
copy(
{ - bool? isCancel,
- bool? isSuccessful,
- bool? isLoading,
- bool? isFailed,
- T? data,
- List<T>? result,
- String? message,
- String? error,
- dynamic snapshot,
- Status? status,
- String? tag,
})
Implementation
Response<T> copy({
bool? isCancel,
bool? isSuccessful,
bool? isLoading,
bool? isFailed,
T? data,
List<T>? result,
String? message,
String? error,
dynamic snapshot,
Status? status,
String? tag,
}) {
return Response<T>(
isCancel: isCancel ?? this.isCancel,
isLoading: isLoading ?? this.isLoading,
isSuccessful: isSuccessful ??
(result != null
? true
: message != null
? true
: this.isSuccessful),
isFailed: isFailed ?? this.isFailed,
data: data ?? this.data,
result: result ?? this.result,
snapshot: snapshot ?? this.snapshot,
tag: tag ?? this.tag,
message:
message ?? (isSuccessful ?? false ? "Successful!" : this.message),
error: error ?? this.error,
status: status ??
(result != null
? Status.ok
: (snapshot != null
? Status.created
: (message != null ? Status.notFound : this.status))),
);
}