BaseOptions class

The common config for the Dio instance. dio.options is a instance of BaseOptions

Mixed in types

Constructors

BaseOptions({String? method, Duration? connectTimeout, Duration? receiveTimeout, Duration? sendTimeout, String baseUrl = '', Map<String, dynamic>? queryParameters, Map<String, dynamic>? extra, Map<String, dynamic>? headers, ResponseType? responseType = ResponseType.json, String? contentType, ValidateStatus? validateStatus, bool? receiveDataWhenStatusError, bool? followRedirects, int? maxRedirects, bool? persistentConnection, RequestEncoder? requestEncoder, ResponseDecoder? responseDecoder, ListFormat? listFormat})

Properties

baseUrl String
Request base url, it can contain sub paths like: https://pub.dev/api/.
read / writeinherited
connectTimeout Duration?
Timeout in milliseconds for opening url. Dio will throw the DioError with DioErrorType.connectionTimeout type when time out.
read / writeinherited
contentType String?
The request Content-Type.
read / writeinherited
extra Map<String, dynamic>
Custom field that you can retrieve it later in InterceptorTransformer and the Response object.
read / writeinherited
followRedirects bool
see HttpClientRequest.followRedirects, The default value is true
read / writeinherited
hashCode int
The hash code for this object.
read-onlyinherited
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'.
read / writeinherited
listFormat ListFormat
The listFormat indicates the format of collection data in request query parameters and x-www-url-encoded body data. Possible values defined in ListFormat are csv, ssv, tsv, pipes, multi, multiCompatible. The default value is multi.
read / writeinherited
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 / writeinherited
method String
Http method.
read / writeinherited
persistentConnection bool
see HttpClientRequest.persistentConnection, The default value is true
read / writeinherited
queryParameters Map<String, dynamic>
Common query parameters.
read / writeinherited
receiveDataWhenStatusError bool
Whether receiving response data when http status code is not successful. The default value is true
read / writeinherited
receiveTimeout Duration?
Timeout in milliseconds for receiving data.
read / writeinherited
requestEncoder RequestEncoder?
The default request encoder is utf8encoder, you can set custom encoder by this option.
read / writeinherited
responseDecoder ResponseDecoder?
The default response decoder is utf8decoder, you can set custom decoder by this option, it will be used in Transformer.
read / writeinherited
responseType ResponseType
responseType indicates the type of data that the server will respond with options which defined in ResponseType are json, stream, plain.
read / writeinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
sendTimeout Duration?
Timeout in milliseconds for sending data. Dio will throw the DioError with DioErrorType.sendTimeout type when time out.
read / writeinherited
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 / writeinherited

Methods

copyWith({String? method, String? baseUrl, Map<String, dynamic>? queryParameters, String? path, Duration? connectTimeout, Duration? receiveTimeout, Duration? sendTimeout, 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}) BaseOptions
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