Skip to content
Back to archipelago.banuacoder.com

Debug Tools

How to inspect app storage in the Flutter debug panel ​

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

Adds a storage tab to the debug panel that shows how much space the app uses. The tutorial reads the breakdown on Android and iOS, exports it as JSON and checks that production flavors drop it.

What you'll learn ​

  • Generating the storage inspector sub-brick for app_debugger
  • Reading the storage breakdown on Android and iOS
  • Exporting the breakdown as JSON
  • Stripping the inspector from production-flavor builds

Prerequisites ​

Step 1: Generate the Brick ​

bash
archipelago generate app_debugger_storage

The brick has no variables.

Step 2: Understand the Generated Packages ​

text
features/app_debugger_storage/
├── app_debugger_storage_api/     # StorageInspectorSDK and models
├── app_debugger_storage/         # Debug implementation and Storage tab
│   ├── android/                  # Kotlin StorageAnalyzer
│   ├── ios/                      # Sandbox-limited stub
│   └── lib/src/
└── app_debugger_storage_noop/    # Production-flavor stub

The debug package depends on share_plus and path_provider. The noop and API packages do not. You do not edit AndroidManifest.xml. share_plus registers its own FileProvider, and the manifest merger combines it.

Step 3: Check build_prepare ​

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

yaml
build_prepare:
  mappings:
    - debug: app_debugger_storage
      release: app_debugger_storage_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 hook adds GetIt.I<StorageInspectorSDK>(); at the archipelago:debug_panel_pages marker in app_debugger's lib/src/di/debug_tools.dart. The SDK is an eager singleton, so the Storage tab appears before the first frame.

Step 5: Verify in an Internal Flavor ​

Run the app and open the debug panel. Select the Storage tab.

Android ​

The tab groups storage into four buckets: app bundle, internal data, cache and other. Each bucket lists one level of children:

SourceDescription
APKThe installed APK
filesDirApp files
DatabasesSQLite databases
shared_prefsSharedPreferences files
Code cacheCompiled code cache
Internal and external cacheCache directories
External files and OBBExternal storage

iOS ​

The iOS sandbox limits what the app can read. The tab shows only the app bundle size. A note in the panel explains this.

Step 6: Export the Breakdown ​

Use the export action to write the breakdown as JSON and open the share sheet. From code:

dart
final sdk = getIt<StorageInspectorSDK>();
final breakdown = await sdk.captureBreakdown();
final path = await sdk.exportAsJson();

Send the file to your computer to compare builds or share a bug report.

Next Steps ​