Response<BodyType> class
A http.BaseResponse
wrapper representing a response of a Chopper network call.
@Get(path: '/something')
Future<Response> fetchSomething();
@Get(path: '/items/{id}')
Future<Response<Item>> fetchItem();
- Annotations
-
- @immutable
Properties
- base → BaseResponse
-
The
http.BaseResponse
frompackage:http
that this Response wraps.final - body → BodyType?
-
The body of the response after conversion by Chopper
See Converter for more on body conversion.
final
- bodyBytes → Uint8List
-
Returns the response body as bytes (Uint8List) provided the network
call was successful, else this will be
null
.no setter - bodyString → String
-
Returns the response body as a String provided the network
call was successful, else this will be
null
.no setter - error → Object?
-
The body of the response if isSuccessful is false.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String> -
HTTP headers of the response.
no setter
- isSuccessful → bool
-
Whether the network call was successful or not.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- statusCode → int
-
The HTTP status code of the response.
no setter
Methods
-
copyWith<
NewBodyType> ({BaseResponse? base, NewBodyType? body, Object? bodyError}) → Response< NewBodyType> - Makes a copy of this Response, replacing original values with the given ones. This method can also alter the type of the response body.
-
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