withException method

Response<T> withException(
  1. dynamic exception, {
  2. Status? status,
})

Sets the response as having encountered an exception.

exception: The exception encountered. status: Status of the response. Returns the modified Response object with updated exception status.

Implementation

Response<T> withException(dynamic exception, {Status? status}) {
  _status = status;
  _exception = exception;
  _successful = false;
  _error = true;
  _message = null;
  _loading = false;
  return this;
}