Skip to content
Back to archipelago.banuacoder.com

Feature SDKs (Pro)

app_debugger_network Pro ​

Tier
Proversion 1.2.4
Command
archipelago generate app_debugger_network
Generates
  • features/app_debugger_network/app_debugger_network
  • features/app_debugger_network/app_debugger_network_api
  • features/app_debugger_network/app_debugger_network_noop
Generates first
test_prereq, network_sdk, app_debuggerwhen needed and missing, so there is nothing to install first
Depends on
shared_identifiersgenerate these first

Alice-based HTTP inspector sub-brick for app_debugger. Adds a Network tool to the debugger. Supports Dio and http network libraries. Automatically swapped to a no-op stub in production-flavor builds via build_prepare.yaml.

Variables ​

VariableTypeDefaultDescription
networkLibraryenumdioWhich HTTP client library to inspect. Must match your network SDK choice. Values: dio, http

Prerequisites ​

  • app_debugger is generated first when the project lacks it.
  • Network SDK must be one of network_sdk_dio or network_sdk_http. pre_gen generates network_sdk first when infrastructure/network_sdk_api is missing and stops if it predates NetworkInterceptorRegistry (network_sdk 2.4.0).

Usage ​

Interactive ​

bash
archipelago generate app_debugger_network

Non-interactive (CI) ​

bash
archipelago generate app_debugger_network --config my_config.json

When archipelago.yaml is present, networkLibrary is auto-detected from infrastructure.network_library.

Generated Structure ​

text
features/
└── app_debugger_network/
    ├── app_debugger_network_api/
    │   └── lib/src/
    │       └── models/
    ├── app_debugger_network/
    │   └── lib/src/
    │       └── di/
    └── app_debugger_network_noop/
        └── lib/src/
            └── di/

Required Setup ​

Alice's navigator key is wired automatically — NetworkInspectorSDKImpl.initialize() attaches DebugOverlayHost.instance.navigatorKey (the same shared debug Navigator app_debugger's panel uses), so "Open Full Inspector", the system notification tap, and device-shake all work out of the box. No MaterialApp wiring needed.

The adapter attaches itself ​

NetworkInspectorSDKImpl offers Alice's adapter to network_sdk_api's NetworkInterceptorRegistry. DioHttpClient (Dio) adopts it as an interceptor and DartHttpClient (http) adopts AliceHttpAdapter.onResponse as a response observer, whichever is built first. No hand edit is needed, and a client built with DioHttpClient.init / DartHttpClient is covered. A client you construct yourself from plain Dio() or http.Client() is not.

Production builds register nothing: build_prepare swaps in the noop twin, which never touches the registry.

API ​

dart
abstract interface class NetworkInspectorSDK implements FeatureSDK {
  bool get isActive;

  /// Dio: `AliceDioAdapter`. http: `AliceHttpAdapter`. noop: `null`.
  Object? get adapter;

  void showInspector();
}

How It Works ​

  1. NetworkInspectorSDKImpl registers a NetworkInspectorPage with DebuggerPanelPageRegistry on construction.
  2. The debugger home reads DebuggerPanelPageRegistry.instance.pages and lists each page as a tool on its own route — no import of app_debugger_network required.
  3. build_prepare.yaml swaps app_debugger_network → app_debugger_network_noop for production-flavor builds, stripping all Alice code from the binary.
  4. NetworkInspectorSDKImpl.initialize() (run automatically by the pre-launch FeatureSDK sweep) attaches DebugOverlayHost.instance.navigatorKey to Alice — the same shared Navigator app_debugger's own panel pushes onto, so Alice needs no Navigator/ModalRoute of its own and inherits that host's back-button and accessibility mitigations for free.

DI and wiring notes ​

post_gen.dart patches app_debugger's own features/app_debugger/app_debugger/lib/src/di/debug_tools.dart, inserting an eager GetIt.I<NetworkInspectorSDK>() call inside the two-segment // archipelago:debug_panel_pages:start/:end sentinel that app_debugger's own template ships. This moved off bootstrap.dart in 1.1.7 to match where all debug_panel_pages wiring now lives; that is the target on a current project. The marker moved between app_debugger versions, so the hook uses the first file that has it: app_debugger's lib/src/di/debug_tools.dart (2.0.0 and later), its lib/src/app_debugger_sdk_impl.dart (1.3.0 to 1.15.x), then the app's lib/bootstrap.dart (older), and adds the imports and path dependencies to that package. A file that already resolves the SDK is left as it is. If no file has the marker, pre_gen prints the lines to add and stops before it writes any file.

app_debugger_network/pubspec.yaml also declares:

yaml
archipelago:
  di_modules:
    - class: AppDebuggerNetworkPackageModule

so monorepo_toolkit generate host-registry can rediscover the module later. The noop counterpart (app_debugger_network_noop) is hand-written directly in injector.dart with the same AppDebuggerNetworkPackageModule class name (no codegen, no committed injector.module.dart) — a mismatch here used to be a landmine build_prepare's import-only rewrite couldn't fix (fixed in 1.1.9).

Testing ​

Alice() initializes flutter_local_notifications and asks for notification permission in its constructor, and NetworkInspectorSDKImpl resolves Alice while initializeInjector() runs. Under flutter test no platform answers, so the package ships AppDebuggerNetworkTestPrerequisite in package:app_debugger_network/testing.dart and declares it under archipelago: test_prerequisites. monorepo_toolkit generate test-harness adds it to the app's composition-root harness (see Testing and test_prereq).

Dependencies ​

  • alice: ^1.0.0, plus alice_dio: ^1.0.0 (when networkLibrary: dio) or alice_http: ^1.0.0 (when networkLibrary: http)
  • app_debugger_api (path dependency into the sibling app_debugger brick's API package) — hard prerequisite, not self-generated; pre_gen.dart/post_gen.dart only auto-detect the network library and patch app_debugger's files, they don't invoke SubBrickGenerator
  • feature_sdk, identifiers, router_registry, dependencies — shared packages

Known Limitations ​

  • networkLibrary must match whatever network SDK (network_sdk_dio vs network_sdk_http) is actually installed — auto-detection reads archipelago.yaml's infrastructure.network_library but falls back to dio if that key is absent, which is wrong for an http-only project with no config file.
  • Only clients built by DioHttpClient / DartHttpClient are inspected. A hand-built Dio() or http.Client() is not.

Changelog ​

Run archipelago brick info app_debugger_network to see the latest published version. Enterprise customers can read the full CHANGELOG.md in the brick source repository.