HttpResponse<T> class
HTTP response entity
Constructors
-
HttpResponse({required bool isSuccess, T? data, String? error, required int statusCode, Map<
String, String> headers = const {}, Duration? duration, String? rawBody}) -
const
-
HttpResponse.error({required String error, required int statusCode, Map<
String, String> headers = const {}, Duration? duration, String? rawBody}) -
Create error response
factory
-
HttpResponse.success({required T data, required int statusCode, Map<
String, String> headers = const {}, Duration? duration, String? rawBody}) -
Create successful response
factory
Properties
- data → T?
-
final
- duration → Duration?
-
final
- error → String?
-
final
- hasData → bool
-
Check if response has data
no setter
- hasError → bool
-
Check if response has error
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String> -
final
- isClientError → bool
-
Check if response indicates client error (4xx)
no setter
- isServerError → bool
-
Check if response indicates server error (5xx)
no setter
- isSuccess → bool
-
final
- performanceCategory → String
-
Get performance category based on duration
no setter
- rawBody → String?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- statusCode → int
-
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
transform<
R> (R transformer(T)) → HttpResponse< R> - Transform response data
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited