flutter_api_inspector 0.2.0
flutter_api_inspector: ^0.2.0 copied to clipboard
Manual API instrumentation and a debug-only in-app overlay timeline for Flutter. Developers call ApiTrace.call(name, …, execute: …) at the call site; the package records each call into an in-memory ri [...]
Changelog #
All notable changes to flutter_api_inspector are documented in this
file. The format follows Keep a Changelog
and the project adheres to Semantic Versioning.
0.2.0 — 2026-07-06 #
Added #
ApiTrace.forceEnabledflag: when set totruebeforeApiTrace.runApp(), the overlay works even in release builds. Useful for QA tester builds, custom flavors, or feature-flag-gated development modules. The threekDebugModeguards (runApp,ApiTraceBootstrap,ApiTraceOverlay) now use!kDebugMode && !forceEnabledso the harness and overlay are constructed when either debug mode or force-enabled is active.- The overlay now adopts the HOST app's colors: every surface token
derives from the app's
ColorScheme(Material 3 tonal surface roles), so the panel carries the app's primary tint instead of a fixed grey palette. - Contrast guarantee: accent, success/error, and HTTP-method colors
pass through
inspectorEnsureContrast, which nudges any low-contrast color toward black/white until it reaches WCAG 3.0 against the panel background — a pastel primary stays readable. - FAB polish: the icon is now the same bolt as the panel header,
colors come from the scheme's
primaryContainer/onPrimaryContainerpair, and a small error-colored dot appears when the timeline holds failed calls. - Panel close affordances: tapping outside the panel (scrim) or the new X button in the header closes it.
- Single-import barrel:
flutter_api_inspector.dartnow exportsTracedDioInterceptorandTracedHttpOverrides/TracedHttpClienttoo, so one import covers the whole package. The sub-path imports remain available. (The package targets mobile / desktop — web already has the browser Network tab.)
Fixed #
BootstrapMaterialAppHarnessalways forcesdebugShowCheckedModeBanner: falseso the debug-only overlay never adds an extra banner on top of the developer's own banner setting.ApiTrace.runAppcrashed real apps on startup with "The render object for Semantics cannot find ancestor render object to attach to" + "No MediaQuery widget ancestor found": it calledattachRootWidgetwithoutbinding.wrapWithDefaultView, so no rootView/RenderViewwas ever created (Flutter's ownrunApphas wrapped with the default View since 3.10). Both the debug and release paths now wrap correctly.BootstrapMaterialAppHarnessnow forwards EVERYMaterialAppconstructor property (routes,onGenerateRoute,initialRoute,onUnknownRoute, localization,scrollBehavior,shortcuts/actions, debug flags, …) instead of a small subset, composes the developer's ownbuilderwith the overlay, and supports router-based apps (MaterialApp.router). Activating the overlay no longer breaks routes-based navigation or localization.- Request bodies are now actually captured.
TracedHttpOverridesbuffers request bytes as they are written (capped atmaxResponseBodyBytes) andTracedDioInterceptorsnapshotsoptions.data/options.headersat request time.ApiTrace.calllifts the request payload intorecord.requestso the detail screen renders it (previouslyrecord.requestwas always null). - Installing
TracedHttpOverridesandTracedDioInterceptortogether no longer records every Dio call twice: the Dio interceptor defers to the overrides layer automatically (opt out withTracedDioInterceptor(deferToHttpOverrides: false)for custom adapters that bypassdart:io). - The timeline panel header badge now shows the FILTERED record count instead of the timeline total when an outcome filter or a name query is active.
- Doc comments in
detail.dart,config.dart, and the example claimed the default detail set was{minimal}; the actual default is{minimal, response}(aligned with the README).
Changed #
Timelineis now a true circular buffer:appendis O(1) with no element shifting (wasList.insert(0, …), O(n) per append).Timeline.recordsremains an unmodifiable, newest-firstList.- Minimum Flutter bumped to 3.27 / Dart 3.6: the code already used
Color.withValues(3.27+) and the theme now uses thesurfaceContainer*scheme roles (3.22+); the previous>=3.16constraint was never accurate.
0.1.0 — 2026-06-23 #
Added #
- Initial MVP release of
flutter_api_inspector. ApiTrace.call(name, method, url, execute, detailOverride, extra)— manual API capture with a privacy-conscious default ({ApiTraceDetail.minimal}only).ApiTrace.enabledmaster switch (defaults tokDebugModeat first read; mutable thereafter).ApiTrace.configglobal configuration withdetails,maxResponseBodyBytes(4 KB default),timelineCapacity(200 default),overlayPosition(4 values), andoverlayLabel(3 values).ApiTrace.timeline— in-memory ring buffer with newest-first ordering and silent eviction at capacity.ApiTrace.runApp(Widget app)— one-line bootstrap that mounts the overlay in debug mode and passes through torunAppin release.ApiTrace.showOverlay/ApiTrace.hideOverlay— programmatic overlay control.ApiTraceOverlaywidget with a configurable floating action button (position and label shape) and a panel that lists the timeline in chronological order with filter chips (success-only, error-only, name substring).ApiTraceDetailScreen— read-only detail view (no cURL export, no re-run, no export).kDebugModeguard at four call sites so the overlay is tree-shaken fromflutter build --releasebinaries.- Zero new third-party dependencies (only
flutterandflutter_test). - Strict TDD: every behavior-shipping change has RED → GREEN →
TRIANGULATE → REFACTOR evidence recorded in
openspec/changes/flutter_api_inspector-mvp/apply-progress.md.
Non-goals (explicit, in scope of v1 exclusion) #
- No auto-interceptor (no
http.Clientwrap, no Dio shim). - No disk persistence (no
shared_preferences, no SQLite, no file export). - No cURL export, no re-run, no replay.
- No network mocking, rewriting, or blocking.
- No multi-window / multi-tab support.
- No Flutter web support in v1.
- No regex / field-query search.
- No telemetry, no analytics, no auto-upload.