http_inspect_view 1.0.0 copy "http_inspect_view: ^1.0.0" to clipboard
http_inspect_view: ^1.0.0 copied to clipboard

A debug-only HTTP inspector for Flutter apps. Intercepts every Dio request/response, shows OS notifications per request, and lets you shake the device to open a full log viewer — with no widget wrappe [...]

http_inspect_view #

A debug-only HTTP inspector for Flutter apps. Intercepts every Dio request/response, shows OS notifications per request, and lets you shake the device to open a full log viewer — with no widget wrapper required.

Active only in debug and profile builds. Completely silent in release.


Features #

  • 🔌 Zero-widget setup — just add the Dio interceptor
  • 📋 Full log viewer — method, status, headers, request & response body, duration
  • 🔔 OS notifications per request (tap to open the inspector)
  • 📳 Shake-to-open the log viewer at any time
  • 🔗 Share logs as cURL, plain text, or JSON
  • 🔍 Search & filter by URL or HTTP method

Platform setup #

iOS #

1 — AppDelegate.swift

import Flutter
import UIKit
import flutter_local_notifications

@main
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
    UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
    // Required for flutter_local_notifications background isolate
    FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { registry in
      GeneratedPluginRegistrant.register(with: registry)
    }
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

2 — Info.plist

Add the motion permission for shake-to-open:

<key>NSMotionUsageDescription</key>
<string>This app uses motion sensors to open the HTTP inspector by shaking the device.</string>

Android #

AndroidManifest.xml

Add the notification permission for Android 13+ (API 33+):

<!-- Required for local notifications on Android 13+ -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

Usage #

1 — Add the Dio interceptor #

import 'package:http_inspect_view/http_inspect_view.dart';

dio.interceptors.add(
  HttpInspectorInterceptor(
    // Pass a getter — evaluated at tap/shake time, not at DI setup time.
    // This avoids a stale reference if NavigationService.navigatorKey is
    // reassigned to AppRouterConfig.navigatorKey after runApp().
    navigatorKey: () => NavigationService.navigatorKey,
  ),
);

Disable notifications but keep shake-to-open:

dio.interceptors.add(
  HttpInspectorInterceptor(
    navigatorKey: () => NavigationService.navigatorKey,
    showNotification: false,
  ),
);

2 — Optional: HttpInspector widget #

Wrap your root widget if you need explicit hot-reload safety or lifecycle control. Not required for normal use — the interceptor starts everything automatically.

HttpInspector(
  navigatorKey: () => NavigationService.navigatorKey,
  child: MyApp(),
)

How it works #

Trigger Behaviour
Every request completes OS notification appears (tap to open inspector)
Shake the device Inspector list slides up as a fullscreen dialog
Tap any log entry Full detail view: Overview · Request · Response tabs
Share button cURL command · full text · JSON export

Additional information #

  • All data is stored in memory only — cleared when the app restarts.
  • To clear logs at runtime, tap the 🗑 button in the inspector list.
  • The inspector is a no-op in release builds — no tree-shaking required.
0
likes
130
points
0
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A debug-only HTTP inspector for Flutter apps. Intercepts every Dio request/response, shows OS notifications per request, and lets you shake the device to open a full log viewer — with no widget wrapper required.

Homepage

License

MIT (license)

Dependencies

dio, flutter, flutter_local_notifications, sensors_plus, share_plus

More

Packages that depend on http_inspect_view