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.