modify method

Response<T> modify({
  1. bool? available,
  2. bool? cancel,
  3. bool? complete,
  4. bool? error,
  5. bool? failed,
  6. bool? internetError,
  7. bool? loading,
  8. bool? nullable,
  9. bool? paused,
  10. bool? stopped,
  11. bool? successful,
  12. bool? timeout,
  13. bool? valid,
  14. T? data,
  15. List<T>? backups,
  16. List<T>? ignores,
  17. List<T>? result,
  18. double? progress,
  19. Status? status,
  20. String? exception,
  21. String? message,
  22. dynamic feedback,
  23. dynamic snapshot,
})

Modifies the current Response object with optional changes.

available: Indicates if the response is available. cancel: Indicates if the response has been cancelled. complete: Indicates if the response is complete. error: Indicates if an error occurred. failed: Indicates if the operation failed. internetError: Indicates if there's an internet error. loading: Indicates if the response is currently loading. nullable: Indicates if the response can be null. paused: Indicates if the response is paused. stopped: Indicates if the response is stopped. successful: Indicates if the operation was successful. timeout: Indicates if there was a timeout. valid: Indicates if the response is valid. data: The data associated with the response. backups: List of backup data. ignores: List of ignored data. result: List of results. progress: Progress value. status: Status of the response. exception: Exception message. message: Additional message. feedback: Feedback data. snapshot: Snapshot data.

Implementation

Response<T> modify({
  bool? available,
  bool? cancel,
  bool? complete,
  bool? error,
  bool? failed,
  bool? internetError,
  bool? loading,
  bool? nullable,
  bool? paused,
  bool? stopped,
  bool? successful,
  bool? timeout,
  bool? valid,
  T? data,
  List<T>? backups,
  List<T>? ignores,
  List<T>? result,
  double? progress,
  Status? status,
  String? exception,
  String? message,
  dynamic feedback,
  dynamic snapshot,
}) {
  successful = successful ?? ((data != null || result != null) ? true : null);
  _available = available ?? _available;
  _cancel = cancel ?? _cancel;
  _complete = complete ?? _complete;
  _error = error ?? _error;
  _failed = failed ?? _failed;
  _internetError = internetError ?? _internetError;
  _loading = loading ?? _loading;
  _nullable = nullable ?? _nullable;
  _paused = paused ?? _paused;
  _stopped = stopped ?? _stopped;
  _successful = successful ?? _successful;
  _timeout = timeout ?? _timeout;
  _valid = valid ?? _valid;
  _data = data ?? _data;
  _backups = backups ?? _backups;
  _ignores = ignores ?? _ignores;
  _result = result ?? _result;
  _progress = progress ?? _progress;
  _status = status ?? _status;
  _exception = exception ?? _exception;
  _message = message ?? _message;
  this.feedback = feedback ?? this.feedback;
  this.snapshot = snapshot ?? this.snapshot;
  return this;
}