RequestOptions class

Inheritance

Constructors

RequestOptions({String method, int connectTimeout, int sendTimeout, int receiveTimeout, Iterable<Cookie> cookies, dynamic data, String path, Map<String, dynamic> queryParameters, String baseUrl, ProgressCallback onReceiveProgress, CancelToken cancelToken, Map<String, dynamic> extra, Map<String, dynamic> headers, ResponseType responseType, ContentType contentType, ValidateStatus validateStatus, bool receiveDataWhenStatusError: true, bool followRedirects: true, int maxRedirects, RequestEncoder requestEncoder, ResponseDecoder responseDecoder})

Properties

baseUrl ↔ String
Request base url, it can contain sub path, like: "https://www.google.com/api/".
read / write
cancelToken CancelToken
read / write
data ↔ dynamic
Request data, can be any type.
read / write
onReceiveProgress ProgressCallback
read / write
onSendProgress ProgressCallback
read / write
path ↔ String
If the path starts with "http(s)", the baseURL will be ignored, otherwise, it will be combined and then resolved with the baseUrl.
read / write
queryParameters ↔ Map<String, dynamic>
See Uri.queryParameters
read / write
uri → Uri
generate uri
read-only
connectTimeout ↔ int
Timeout in milliseconds for opening url. Dio will throw the DioError with DioErrorType.CONNECT_TIMEOUT type when time out.
read / write, inherited
contentType ↔ ContentType
The request Content-Type. The default value is ContentType.json. If you want to encode request body with "application/x-www-form-urlencoded", you can set ContentType.parse("application/x-www-form-urlencoded"), and Dio will automatically encode the request body.
read / write, inherited
cookies ↔ List<Cookie>
Custom Cookies for every request
read / write, inherited
extra ↔ Map<String, dynamic>
Custom field that you can retrieve it later in InterceptorTransformer and the Response object.
read / write, inherited
followRedirects ↔ bool
see HttpClientRequest.followRedirects
read / write, inherited
hashCode → int
The hash code for this object.
read-only, inherited
headers ↔ Map<String, dynamic>
Http request headers.
read / write, inherited
maxRedirects ↔ int
Set this property to the maximum number of redirects to follow when followRedirects is true. If this number is exceeded an error event will be added with a RedirectException.
read / write, inherited
method ↔ String
Http method.
read / write, inherited
receiveDataWhenStatusError ↔ bool
Whether receiving response data when http status code is not successful.
read / write, inherited
receiveTimeout ↔ int
Timeout in milliseconds for receiving data. Dio will throw the DioError with DioErrorType.RECEIVE_TIMEOUT type when time out.
read / write, inherited
requestEncoder RequestEncoder
The default request encoder is utf8encoder, you can set custom encoder by this option.
read / write, inherited
responseDecoder ResponseDecoder
The default response decoder is utf8decoder, you can set custom decoder by this option, it will be used in Transformer.
read / write, inherited
responseType ResponseType
responseType indicates the type of data that the server will respond with options which defined in ResponseType are json, stream, plain.
read / write, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited
sendTimeout ↔ int
Timeout in milliseconds for sending data. Dio will throw the DioError with DioErrorType.SEND_TIMEOUT type when time out.
read / write, inherited
validateStatus ValidateStatus
validateStatus defines whether the request is successful for a given HTTP response status code. If validateStatus returns true , the request will be perceived as successful; otherwise, considered as failed.
read / write, inherited

Methods

merge({String method, int connectTimeout, int receiveTimeout, dynamic data, Map<String, dynamic> extra, Map<String, dynamic> headers, ResponseType responseType, ContentType contentType, Iterable<Cookie> cookies, ValidateStatus validateStatus, bool receiveDataWhenStatusError, bool followRedirects, int maxRedirects, RequestEncoder requestEncoder, ResponseDecoder responseDecoder}) Options
Create a new Option from current instance with merging attributes.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator.
inherited