Dio Requests Inspector
A HTTP inspector for Dio, which can intercept and log HTTP requests and responses.
Features
XIntercept and log HTTP requests and responsesXSecure HTTP requests with passwordsXFilter logs by request time, method, and statusXSearch logs by pathXEasily share request and response dataXBeautify JSON dataXBeautiful user interface
How to use
- Add the package with command
flutter pub add dio_request_inspector
- add
navigatorObserversto yourMaterialApp
navigatorObservers: [
DioRequestInspector.navigatorObserver,
],
- Wrap your
myAppwithDioRequestInspectorMain
void main() {
runApp(DioRequestInspectorMain(
isDebugMode: true,
child: MyApp(),
));
}
- add interceptor to your Dio instance
final DioRequestInspector inspector = DioRequestInspector(
isInspectorEnabled: true,
password: '123456', // remove this line if you don't need password
showSummary: false,
);
dio.interceptors.add(inspector.getDioRequestInterceptor());
see detail example
Note
- tap
Long presson your screen to show DioRequestInspector UI