dio_request_inspector 3.2.1 copy "dio_request_inspector: ^3.2.1" to clipboard
dio_request_inspector: ^3.2.1 copied to clipboard

A HTTP inspector for Dio, which can intercept and log HTTP requests and responses.

Dio Requests Inspector

A HTTP inspector for Dio, which can intercept and log HTTP requests and responses.



ss

Features #

  • ✅ Intercept and log HTTP requests and responses
  • ✅ Secure HTTP requests with passwords
  • ✅ Filter logs by request time, method, and status
  • ✅ Search logs by path
  • ✅ Easily share request and response data
  • ✅ Beautify JSON data
  • ✅ Image support for responses
  • ✅ Response body searching
  • ✅ Summary flag support
  • ✅ Copy to cURL
  • ✅ Beautiful user interface

How to use #

  • Add the package with command
flutter pub add dio_request_inspector
  • Create and configure DioRequestInspector instance
final DioRequestInspector inspector = DioRequestInspector(
  isInspectorEnabled: true,
  password: '123456', // optional, remove if you don't need password
  showSummary: true, // optional, default is true
);
  • add interceptor to your Dio instance
dio.interceptors.add(inspector.getDioRequestInterceptor());
  • Wrap your myApp with DioRequestInspectorMain
void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(
    DioRequestInspectorMain(
      inspector: inspector,
      child: const MyApp(),
    ),
  );
}
  • add navigatorObservers to your MaterialApp
navigatorObservers: [
  DioRequestInspector.navigatorObserver,
],

Usage #

Show Inspector UI #

You can open the DioRequestInspector in two ways:

  1. Long press on your screen to show DioRequestInspector UI (if using DioRequestInspectorMain)

  2. Programmatically call:

inspector.goToInspector();

Parameters #

  • isInspectorEnabled - Enable or disable the inspector (required)
  • password - Optional password protection for the inspector
  • showSummary - Show summary view (default: true)

Example #

See the example directory for a complete working example.

20
likes
140
points
1.28k
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A HTTP inspector for Dio, which can intercept and log HTTP requests and responses.

Homepage

License

BSD-3-Clause (license)

Dependencies

dio, equatable, flutter, rxdart

More

Packages that depend on dio_request_inspector