Options class

Every request can pass an Options object which will be merged with Dio.options

Constructors

Options({String? method, Duration? sendTimeout, Duration? receiveTimeout, Map<String, dynamic>? extra, Map<String, dynamic>? headers, ResponseType? responseType, String? contentType, ValidateStatus? validateStatus, bool? receiveDataWhenStatusError, bool? followRedirects, int? maxRedirects, bool? persistentConnection, RequestEncoder? requestEncoder, ResponseDecoder? responseDecoder, ListFormat? listFormat})

Properties

contentType String?
The request content-type.
read / write
extra Map<String, dynamic>?
An extra map that you can retrieve in Interceptor, Transformer and Response.requestOptions.
read / write
followRedirects bool?
See HttpClientRequest.followRedirects.
read / write
hashCode int
The hash code for this object.
read-onlyinherited
headers Map<String, dynamic>?
HTTP request headers.
read / write
listFormat ListFormat?
Indicates the format of collection data in request query parameters and x-www-url-encoded body data.
read / write
maxRedirects int?
The maximum number of redirects when followRedirects is true. RedirectException will be thrown if redirects exceeded the limit.
read / write
method String?
The HTTP request method.
read / write
persistentConnection bool?
See HttpClientRequest.persistentConnection.
read / write
receiveDataWhenStatusError bool?
Whether to retrieve the data if status code indicates a failed request.
read / write
receiveTimeout Duration?
Timeout when receiving data.
read / write
requestEncoder RequestEncoder?
The default request encoder is utf8encoder, you can set custom encoder by this option.
read / write
responseDecoder ResponseDecoder?
The default response decoder is utf8decoder, you can set custom decoder by this option, it will be used in Transformer.
read / write
responseType ResponseType?
Indicates the type of data that the server will respond with options.
read / write
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
sendTimeout Duration?
Timeout when sending data.
read / write
validateStatus ValidateStatus?
Defines whether the request is succeed with the given status code. The request will be treated as succeed if the callback returns true.
read / write

Methods

compose(BaseOptions baseOpt, String path, {Object? data, Map<String, dynamic>? queryParameters, CancelToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, StackTrace? sourceStackTrace}) RequestOptions
copyWith({String? method, Duration? sendTimeout, Duration? receiveTimeout, Map<String, Object?>? extra, Map<String, Object?>? headers, ResponseType? responseType, String? contentType, ValidateStatus? validateStatus, bool? receiveDataWhenStatusError, bool? followRedirects, int? maxRedirects, bool? persistentConnection, RequestEncoder? requestEncoder, ResponseDecoder? responseDecoder, ListFormat? listFormat}) Options
Create a Option from current instance with merging attributes.
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