Skip to content
Back to archipelago.banuacoder.com

Debug Tools

How to inspect analytics events in the Flutter debug panel ​

Pro Reference for app_debugger_analytics: every variable, option and package it generates. Command: archipelago generate app_debugger_analytics

Generate the analytics inspector for app_debugger, see what wiring the hook patches, read the consent banner, and strip the tool from production flavors.

What you'll learn ​

  • Generating the analytics inspector sub-brick for app_debugger
  • Seeing which wiring the hook patches for you
  • Reading the consent banner in the Analytics tab
  • Stripping the inspector from production-flavor builds

Prerequisites ​

The brick depends on analytics_api only, never on analytics_impl.

Step 1: Generate the Brick ​

bash
archipelago generate app_debugger_analytics

The brick has no variables.

Step 2: Understand the Generated Packages ​

text
features/app_debugger_analytics/
├── app_debugger_analytics_api/     # AnalyticsInspectorSDK contract and models
├── app_debugger_analytics/         # Debug implementation and Analytics tab
│   └── lib/src/
│       ├── analytics_debugger_interceptor.dart
│       ├── analytics_inspector_page.dart
│       ├── analytics_inspector_sdk_impl.dart
│       └── consent_status_banner.dart
└── app_debugger_analytics_noop/    # Production-flavor stub

The ring buffer holds 1000 entries by default. The oldest entry goes first when it is full. The interceptor only observes. It never drops, changes or delays an event.

Step 3: Check build_prepare ​

The brick adds the swap entry to build_prepare.yaml for you:

yaml
build_prepare:
  mappings:
    - debug: app_debugger_analytics
      release: app_debugger_analytics_noop

The generated Fastfile runs dart run monorepo_toolkit build-prepare --flavor <flavor> before every build. Internal flavors keep the inspector, also in release mode. The production flavor gets the noop.

Step 4: Check the Wiring ​

The post-generation hook patches three places. You add nothing by hand. Check that each is present.

In features/app_debugger/app_debugger/lib/src/di/debug_tools.dart:

dart
// archipelago:debug_panel_pages:start
GetIt.I<AnalyticsInspectorSDK>();
// archipelago:debug_panel_pages:end

// archipelago:analytics_inspector_interceptor:start
final analyticsInterceptor = GetIt.I<AnalyticsInspectorSDK>().interceptor;
if (analyticsInterceptor != null) {
  AnalyticInterceptorRegistry.instance.register(analyticsInterceptor);
}
// archipelago:analytics_inspector_interceptor:end

The first block makes the tab appear. The second block adds the interceptor to the analytics chain. The noop returns null, so nothing registers in production.

The hook also adds AnalyticsInitializer.initialize() to post_launch_initializer.dart if it is missing. This starts the vendors.

If a target is missing, the hook warns and names the marker. Add the lines by hand.

Step 5: Verify in an Internal Flavor ​

Run the app and open the debug panel. Open the Analytics tab. Track a test event:

dart
await getIt<AnalyticTracker>().track(MyTestEvent());

The event appears in the tab.

A banner sits above the event list. It shows one of three states:

  • Granted: events reach the inspector.
  • Denied: the consent interceptor drops events before the inspector sees them.
  • Forced: a debug override grants consent, for example CONSENT_DEBUG_GRANT_ALL.

An empty tab with a denied banner means consent is the cause.

Ring Buffer Reference ​

PropertyValue
Capacity1000 entries (AnalyticsInspectorConfig.maxEntries)
Payload captureOn (capturePayloads: false hides parameters)
Impact on deliveryNone
In the production flavorNo, the noop is swapped in

Next Steps ​