GoogleHTTPResponse<BodyType> class

It is a http.BaseResponse wrapper representing a response of a network call.

@Get(path: '/something')
Future<CHResponse> fetchSomething();
@Get(path: '/items/{id}')
Future<CHResponse<Item>> fetchItem();
Annotations
  • @immutable

Constructors

GoogleHTTPResponse(BaseResponse base, BodyType? body, {GoogleErrorResponse? error, dynamic extraData})
const

Properties

base → BaseResponse
The http.BaseResponse from package:http that this GoogleHTTPResponse 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 → GoogleErrorResponse?
The body of the response if isSuccessful is false.
final
extraData → dynamic
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, GoogleErrorResponse? error}) → GoogleHTTPResponse<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