Result<T> class

A generic Result class to hold the outcome of operations.

Implementers

Constructors

Result.new({T? data, dynamic errorData, Response? response, Exception? exception, int? statusCode = 200, String? statusMessage = ''})
Constructor for creating a new Result instance.
Result.cache({T? data, Exception? exception})
Factory method to create a cache result.
factory
Result.error({Exception? exception})
Factory method to create an error result.
factory
Result.localError({Exception? exception})
Factory method to create a local error result.
factory
Result.localSuccess({T? data})
Factory method to create a local success result.
factory
Result.network({T? data, T? errorData, Response? response, Exception? exception, int? statusCode, String? statusMessage})
Factory method to create a network result.
factory
Result.success({T? data})
Factory method to create a success result.
factory

Properties

data ↔ T?
Holds the data returned from the operation.
getter/setter pair
errorData ↔ dynamic
Holds additional error information, if any.
getter/setter pair
exception Exception?
Exception if an error occurred.
getter/setter pair
hasData bool
Checks if the result contains data.
no setter
hashCode int
The hash code for this object.
no setterinherited
isConnectionError bool
Checks if the error is a connection error (specific to Dio exceptions).
no setter
isError bool
Checks if the result represents an error.
no setter
isLocalError bool
Checks if the result is a local error.
no setter
isLocalSuccess bool
Checks if the result is a local success.
no setter
isSuccess bool
Determines if the result is successful (no errors).
no setter
response Response?
The response object from the API call.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
statusCode int?
HTTP status code for network operations.
getter/setter pair
statusMessage String?
HTTP status message for network operations.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited