WordpressRawResponse class final

Represents a raw response from the WordPress API.

Annotations
  • @immutable

Constructors

WordpressRawResponse({required dynamic data, required int code, Map<String, dynamic> headers = const {}, Map<String, dynamic> requestHeaders = const {}, Duration duration = Duration.zero, Map<String, dynamic> extra = const {}, String? message})
Creates a new WordpressRawResponse instance.
const

Properties

code int
The HTTP status code.
final
data → dynamic
The entire response body. Can be null.
final
duration Duration
The request duration.
final
errorType RequestErrorType
Returns the RequestErrorType for this response.
no setter
extra Map<String, dynamic>
The extra content passed with the request.
final
hashCode int
The hash code for this object.
no setteroverride
headers Map<String, dynamic>
The HTTP response headers.
final
isFailure bool
Returns true if the given code is not in between 200 to 399 range. A convenience method for !isSuccessful.
no setter
isMiddlewareResponse bool
no setter
isSuccessful bool
Returns true if the given code is in between 200 to 399 range.
no setter
message String?
The error message.
final
requestHeaders Map<String, dynamic>
The HTTP request headers.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

asResponse<T>({required T decoder(dynamic data)}) WordpressResponse<T>
Maps this instance to a WordpressResponse instance.
copyWith({dynamic data, int? code, Map<String, dynamic>? headers, Map<String, dynamic>? requestHeaders, Duration? duration, Map<String, dynamic>? extra, String? message}) WordpressRawResponse
getField<T, R>(R key, {bool throwIfError = false, T? transformer(Object object)?, T orElse()?}) → T?
Returns the field value for the given key.
map<T>({required OnSuccess<T> onSuccess, required OnFailure<T> onFailure}) WordpressResponse<T>
Maps this instance to a WordpressResponse instance.
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 ==(covariant WordpressRawResponse other) bool
The equality operator.
override
operator [](dynamic key) → dynamic