RequestOptions class

Inheritance

Constructors

RequestOptions({String? method, int? sendTimeout, int? receiveTimeout, int? connectTimeout, dynamic data, String path = '', Map<String, dynamic>? queryParameters, ProgressCallback? onReceiveProgress, ProgressCallback? onSendProgress, CancelToken? cancelToken, String? baseUrl, Map<String, dynamic>? extra, Map<String, dynamic>? headers, ResponseType? responseType, String? contentType, ValidateStatus? validateStatus, bool? receiveDataWhenStatusError, bool? followRedirects, int? maxRedirects, RequestEncoder? requestEncoder, ResponseDecoder? responseDecoder, CollectionFormat? collectionFormat})

Properties

baseUrl String
Request base url, it can contain sub path, like: "https://www.google.com/api/".
getter/setter pairinherited
cancelToken CancelToken?
getter/setter pair
collectionFormat CollectionFormat
collectionFormat indicates the format of collection data in request options which defined in CollectionFormat are csv, ssv, tsv, pipes, multi,multiCompatible. The default value is multiCompatible
getter/setter pairinherited
connectTimeout int
Timeout in milliseconds for opening url. Dio will throw the DioError with DioErrorType.CONNECT_TIMEOUT type when time out.
getter/setter pairinherited
contentType String?
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.
getter/setter pairinherited
data ↔ dynamic
Request data, can be any type.
getter/setter pair
extra Map<String, dynamic>
Custom field that you can retrieve it later in InterceptorTransformer and the Response object.
getter/setter pairinherited
followRedirects bool
see HttpClientRequest.followRedirects
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, dynamic>
Http request headers. The keys of initial headers will be converted to lowercase, for example 'Content-Type' will be converted to 'content-type'.
getter/setter pairinherited
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.
getter/setter pairinherited
method String
Http method.
getter/setter pairinherited
onReceiveProgress ProgressCallback?
getter/setter pair
onSendProgress ProgressCallback?
getter/setter pair
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.
getter/setter pair
queryParameters Map<String, dynamic>
Common query parameters
getter/setter pairinherited
receiveDataWhenStatusError bool
Whether receiving response data when http status code is not successful.
getter/setter pairinherited
receiveTimeout int
Timeout in milliseconds for receiving data. Dio will throw the DioError with DioErrorType.RECEIVE_TIMEOUT type when time out.
getter/setter pairinherited
requestEncoder RequestEncoder?
The default request encoder is utf8encoder, you can set custom encoder by this option.
getter/setter pairinherited
responseDecoder ResponseDecoder?
The default response decoder is utf8decoder, you can set custom decoder by this option, it will be used in Transformer.
getter/setter pairinherited
responseType ResponseType
responseType indicates the type of data that the server will respond with options which defined in ResponseType are json, stream, plain.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sendTimeout int
Timeout in milliseconds for sending data. Dio will throw the DioError with DioErrorType.SEND_TIMEOUT type when time out.
getter/setter pairinherited
uri Uri
generate uri
no setter
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.
getter/setter pairinherited

Methods

merge({String? method, int? sendTimeout, int? receiveTimeout, int? connectTimeout, String? data, String? path, Map<String, dynamic>? queryParameters, String? baseUrl, ProgressCallback? onReceiveProgress, ProgressCallback? onSendProgress, CancelToken? cancelToken, Map<String, dynamic>? extra, Map<String, dynamic>? headers, ResponseType? responseType, String? contentType, ValidateStatus? validateStatus, bool? receiveDataWhenStatusError, bool? followRedirects, int? maxRedirects, RequestEncoder? requestEncoder, ResponseDecoder? responseDecoder, CollectionFormat? collectionFormat}) RequestOptions
Create a Option from current instance with merging attributes.
override
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