Options class

The configuration for a single request. BaseOptions and Options will be merged into one RequestOptions before sending the requests. See Options.compose.

Constructors

Options({String? method, Duration? sendTimeout, Duration? receiveTimeout, Map<String, dynamic>? extra, Map<String, dynamic>? headers, bool? preserveHeaderCase, 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.
getter/setter pair
extra Map<String, dynamic>?
An extra map that you can retrieve in Interceptor, Transformer and Response.requestOptions.
getter/setter pair
followRedirects bool?
See HttpClientRequest.followRedirects.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, dynamic>?
HTTP request headers.
getter/setter pair
listFormat ListFormat?
Indicates the format of collection data in request query parameters and x-www-url-encoded body data.
getter/setter pair
maxRedirects int?
The maximum number of redirects when followRedirects is true. RedirectException will be thrown if redirects exceeded the limit.
getter/setter pair
method String?
The HTTP request method.
getter/setter pair
persistentConnection bool?
See HttpClientRequest.persistentConnection.
getter/setter pair
preserveHeaderCase bool?
Whether the case of header keys should be preserved.
getter/setter pair
receiveDataWhenStatusError bool?
Whether to retrieve the data if status code indicates a failed request.
getter/setter pair
receiveTimeout Duration?
Timeout when receiving data.
getter/setter pair
requestEncoder RequestEncoder?
The type of a request encoding callback.
getter/setter pair
responseDecoder ResponseDecoder?
The type of a response decoding callback.
getter/setter pair
responseType ResponseType?
The type of data that Dio handles with options.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sendTimeout Duration?
Timeout when sending data.
getter/setter pair
validateStatus ValidateStatus?
Defines whether the request is considered to be successful with the given status code. The request will be treated as succeed if the callback returns true.
getter/setter pair

Methods

compose(BaseOptions baseOpt, String path, {Object? data, Map<String, dynamic>? queryParameters, CancelToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, StackTrace? sourceStackTrace}) RequestOptions
Merge a BaseOptions with the current Options and compose them into the RequestOptions.
copyWith({String? method, Duration? sendTimeout, Duration? receiveTimeout, Map<String, Object?>? extra, Map<String, Object?>? headers, bool? preserveHeaderCase, 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