DioClient class

Implemented types

Constructors

DioClient({required BaseOptions baseOptions, List<Interceptor> interceptors = const []})

Properties

hashCode int
The hash code for this object.
no setterinherited
httpClientAdapter HttpClientAdapter
The adapter that the instance is using.
getter/setter pairinherited
interceptors Interceptors
Each Dio instance has a interceptor group by which you can intercept requests or responses before they are ended.
no setterinherited
options BaseOptions
The base request config for the instance.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
transformer Transformer
The default Transformer that transfers requests and responses into corresponding content to send. For response bodies greater than 50KB, a new Isolate will be spawned to decode the response body to JSON. Taken from https://github.com/flutter/flutter/blob/135454af32477f815a7525073027a3ff9eff1bfd/packages/flutter/lib/src/services/asset_bundle.dart#L87-L93 50 KB of data should take 2-3 ms to parse on a Moto G4, and about 400 μs on a Pixel 4.
getter/setter pairinherited

Methods

close({bool force = false}) → void
Shuts down the dio client.
inherited
delete<T>(String path, {Object? data, Map<String, dynamic>? queryParameters, Options? options, CancelToken? cancelToken}) Future<Response<T>>
Convenience method to make an HTTP DELETE request.
inherited
deleteUri<T>(Uri uri, {Object? data, Options? options, CancelToken? cancelToken}) Future<Response<T>>
Convenience method to make an HTTP DELETE request with Uri.
inherited
download(String urlPath, dynamic savePath, {ProgressCallback? onReceiveProgress, Map<String, dynamic>? queryParameters, CancelToken? cancelToken, bool deleteOnError = true, String lengthHeader = Headers.contentLengthHeader, Object? data, Options? options}) Future<Response>
Download the file and save it in local. The default http method is "GET", you can custom it by Options.method.
inherited
downloadUri(Uri uri, dynamic savePath, {ProgressCallback? onReceiveProgress, CancelToken? cancelToken, bool deleteOnError = true, String lengthHeader = Headers.contentLengthHeader, Object? data, Options? options}) Future<Response>
Download the file and save it in local. The default http method is "GET", you can custom it by Options.method.
inherited
fetch<T>(RequestOptions requestOptions) Future<Response<T>>
The eventual method to submit requests. All callers for requests should eventually go through this method.
inherited
get<T>(String path, {Map<String, dynamic>? queryParameters, Object? data, Options? options, CancelToken? cancelToken, ProgressCallback? onReceiveProgress}) Future<Response<T>>
Convenience method to make an HTTP GET request.
inherited
getUri<T>(Uri uri, {Object? data, Options? options, CancelToken? cancelToken, ProgressCallback? onReceiveProgress}) Future<Response<T>>
Convenience method to make an HTTP GET request with Uri.
inherited
Convenience method to make an HTTP HEAD request.
inherited
headUri<T>(Uri uri, {Object? data, Options? options, CancelToken? cancelToken}) Future<Response<T>>
Convenience method to make an HTTP HEAD request with Uri.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
patch<T>(String path, {Object? data, Map<String, dynamic>? queryParameters, Options? options, CancelToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) Future<Response<T>>
Convenience method to make an HTTP PATCH request.
inherited
patchUri<T>(Uri uri, {Object? data, Options? options, CancelToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) Future<Response<T>>
Convenience method to make an HTTP PATCH request with Uri.
inherited
post<T>(String path, {Object? data, Map<String, dynamic>? queryParameters, Options? options, CancelToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) Future<Response<T>>
Convenience method to make an HTTP POST request.
inherited
postUri<T>(Uri uri, {Object? data, Options? options, CancelToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) Future<Response<T>>
Convenience method to make an HTTP POST request with Uri.
inherited
put<T>(String path, {Object? data, Map<String, dynamic>? queryParameters, Options? options, CancelToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) Future<Response<T>>
Convenience method to make an HTTP PUT request.
inherited
putUri<T>(Uri uri, {Object? data, Options? options, CancelToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) Future<Response<T>>
Convenience method to make an HTTP PUT request with Uri.
inherited
request<T>(String path, {Object? data, Map<String, dynamic>? queryParameters, CancelToken? cancelToken, Options? options, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) Future<Response<T>>
Make HTTP request with options.
inherited
requestUri<T>(Uri uri, {Object? data, CancelToken? cancelToken, Options? options, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) Future<Response<T>>
Make http request with options with Uri.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

getBaseOptions({required String baseUrl, Duration defaultTimeout = const Duration(minutes: 1)}) BaseOptions