A dio helper plug-in,captures requests and views them within the application,providing functions such as request replication and JSON expansion
import 'package:dio_log_viewer/dio_log_viewer.dart';
- init dio and add interceptor
Dio dio = Dio();
...
dio.interceptors.add(DioLogViewerInterceptor());
// enable: true, default true
final bool enable;
// max log count, default 50
final int maxLogCount;
DioLogViewerInterceptor({this.enable = true,this.maxLogCount = 50});
- show log drag button to app entry
DioLogViewer.showLogButton(context);
-
Click the Log button and you will see the intercepted request log
-
hidden log button
DioLogViewer.dismiss()
navigate to the log page LogViewerListPage()
Navigator.of(context).push(CupertinoPageRoute(builder: (context){
return const LogViewerListPage();
}));