dio_ext 0.0.1
dio_ext: ^0.0.1 copied to clipboard

An extensions for Dio.

dio_interceptors #

A log interceptor for Dio.

Sample #

Request "https://www.baidu.com/wd=sdsdf" as an example.

 await ApiClient.getInstance()
        .get("https://www.baidu.com/wd=sdsdf", (data) => data.toString());

The log like this:

Http: --> GET https://www.baidu.com/wd=sdsdf
Http: Headers:{content-type: application/json; charset=utf-8}
Http: --> END GET
Http: <-- 200 OK https://www.baidu.com/wd=sdsdf (2649ms)
Http:{the responseļ¼šOmitted because there is too much content}
Http: <-- END HTTP

Usage #

Configuration #

dio_interceptors: ^0.0.1

Use #

//add the interceptor to your Dio instance.
dio.interceptors.add(new DioLogInterceptor());