Response<T extends Object> class
Represents the response of an operation, containing various flags, data, and status.
T
represents the type of data being handled.
Constructors
-
Response({int requestCode = 0, 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}) - Constructs a Response object with optional initial values.
Properties
-
backups
↔ List<
T> -
getter/setter pair
- beautify → String
-
Returns a beautified string representation of the response.
no setter
- data ↔ T?
-
getter/setter pair
- exception ↔ String
-
getter/setter pair
- feedback ↔ dynamic
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
-
ignores
↔ List<
T> -
getter/setter pair
- isAvailable ↔ bool
-
Indicates if the response is available.
getter/setter pair
- isBackup → bool
-
Indicates if there are backup data available.
no setter
- isCancel ↔ bool
-
Indicates if the response has been cancelled.
getter/setter pair
- isComplete ↔ bool
-
Indicates if the response is complete.
getter/setter pair
- isError ↔ bool
-
Indicates if an error occurred in the response.
getter/setter pair
- isException → bool
-
no setter
- isFailed ↔ bool
-
getter/setter pair
- isIgnored → bool
-
no setter
- isInternetError ↔ bool
-
getter/setter pair
- isLoaded ↔ bool
-
getter/setter pair
- isLoading ↔ bool
-
getter/setter pair
- isMessage → bool
-
no setter
- isNullable ↔ bool
-
getter/setter pair
- isPaused ↔ bool
-
getter/setter pair
- isStopped ↔ bool
-
getter/setter pair
- isSuccessful ↔ bool
-
getter/setter pair
- isTimeout ↔ bool
-
getter/setter pair
- isValid ↔ bool
-
getter/setter pair
- message ↔ String
-
getter/setter pair
- progress ↔ double
-
getter/setter pair
- requestCode → int
-
The request code associated with the response.
final
-
result
↔ List<
T> -
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- snapshot ↔ dynamic
-
getter/setter pair
- status ↔ Status
-
getter/setter pair
Methods
-
copy(
{int? requestCode, 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}) → Response<T> - Creates a copy of the current Response object with optional modifications.
-
from(
Response< T> response) → Response<T> - Creates a new Response object from an existing response.
-
getSnapshot<
Snapshot> () → Snapshot? - Gets the snapshot data if available.
-
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}) → Response<T> - Modifies the current Response object with optional changes.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
Returns a string representation of the response.
override
-
withAvailable(
bool available, {T? data, Status? status, String? message}) → Response< T> - Sets the response as available and optionally provides data, status, and message.
-
withBackup(
T? value, {dynamic feedback, String? message, Status? status}) → Response< T> - Sets a backup value and associated properties with the response.
-
withBackups(
List< T> ? value, {dynamic feedback, String? message, Status? status}) → Response<T> - Attaches a list of backup values to the response.
-
withCancel(
bool cancel, {String? message}) → Response< T> - Sets the response as cancelled and optionally provides a cancellation message.
-
withComplete(
bool complete, {String? message}) → Response< T> - Sets the response as complete and optionally provides a completion message.
-
withData(
T? data, {String? message, Status? status}) → Response< T> - Sets the data associated with the response and marks the response as successful.
-
withException(
dynamic exception, {Status? status}) → Response< T> - Sets the response as having encountered an exception.
-
withFailed(
bool failed) → Response< T> - Sets the response as failed.
-
withFeedback(
dynamic feedback, {String? message, String? exception, Status status = Status.ok, bool loaded = true}) → Response< T> - Sets feedback data and associated properties with the response.
-
withIgnore(
T? value, {String? message, Status? status}) → Response< T> - Sets an ignored value and associated properties with the response.
-
withInternetError(
String message) → Response< T> - Sets the response as having encountered an internet error.
-
withLoaded(
bool loaded) → Response< T> - Sets the loading status of the response.
-
withMessage(
String? message, {Status status = Status.ok}) → Response< T> - Sets a message and status for the response.
-
withNullable(
bool nullable) → Response< T> - Sets the nullable status of the response.
-
withPaused(
bool paused) → Response< T> - Sets the paused status of the response.
-
withProgress(
double progress, {String? message}) → Response< T> - Sets the progress value and optionally provides a message.
-
withResult(
List< T> ? result, {String? message, Status? status}) → Response<T> - Sets the result list and associated properties with the response.
-
withSnapshot(
dynamic snapshot, {String? message, Status? status}) → Response< T> - Sets the snapshot data and associated properties with the response.
-
withStatus(
Status status, {String? message}) → Response< T> - Sets the status of the response.
-
withStopped(
bool stopped) → Response< T> - Sets the stopped status of the response.
-
withSuccessful(
bool successful, {String? message}) → Response< T> - Sets the success status of the response.
-
withTimeout(
bool timeout) → Response< T> - Sets the timeout status of the response.
-
withValid(
bool valid) → Response< T> - Sets the validity status of the response.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited