A powerful Http client for Dart, which supports Interceptors, Global configuration, FormData, File downloading etc. and Dio is very easy to use.
A open source project authorized by https://flutterchina.club.
The common config for the Dio instance.
dio.optionsis a instance of BaseOptions
- You can cancel a request by using a cancel token. One token can be shared with different requests. when a token's cancel method invoked, all requests with this token will be cancelled.
- A powerful Http client for Dart, which supports Interceptors, Global configuration, FormData, File downloading etc. and Dio is very easy to use. [...]
- A class to create readable "multipart/form-data" streams. It can be used to submit forms and file uploads to http server.
- HttpAdapter is a bridge between Dio and HttpClient. [...]
Dio instance may have interceptor(s) by which you can intercept
requests or responses before they are handled by
- Add lock/unlock API for interceptors.
- LogInterceptor is used to print logs during network requests. It's better to add LogInterceptor to the tail of the interceptor queue, otherwise the changes made in the interceptor behind A will not be printed out. This is because the execution of interceptors is in the order of addition.
A file to be uploaded as part of a
MultipartRequest. This doesn't need to correspond to a physical file. [...]
- Every request can pass an Options object which will be merged with Dio.options
- Response describes the http Response info.
- Transformer allows changes to the request/response data before it is sent/received to/from the server. [...]
Future) → Future
DioError e) → dynamic
RequestOptions options) → dynamic
Response e) → dynamic
String) → dynamic
- The default Transformer for Dio. If you want to custom the transformation of request/response data, you can provide a Transformer by your self, and replace the DefaultTransformer by setting the dio.Transformer.
int count, int total) → void
- Callback to listen the progress for sending/receiving data. [...]
String request, RequestOptions options) → List< int>
List< int>responseBytes, RequestOptions options, ResponseBody responseBody) → String
int status) → bool
) → dynamic
Exceptions / Errors
- DioError describes the error info when request failed.