ApiInspectorController class

Coordinates the API inspector capture window and navigation to the UI.

This controller is UI-framework-friendly (ValueNotifiers) and intentionally light on dependencies. Pair it with:

When ApiInspectorOverlay is placed inside MaterialApp's builder (the recommended pattern), its context sits above the Navigator and cannot be used for navigation. Pass the same navigatorKey you give to MaterialApp so the controller can reach the Navigator directly:

final _navigatorKey = GlobalKey<NavigatorState>();
final controller = ApiInspectorController(navigatorKey: _navigatorKey);

MaterialApp(
  navigatorKey: _navigatorKey,
  builder: (context, child) => Stack(children: [
    if (child != null) child,
    ApiInspectorOverlay(controller: controller),
  ]),
)

Constructors

ApiInspectorController({ApiInspectorService? service, GlobalKey<NavigatorState>? navigatorKey, int recordingDurationSeconds = 20, Duration tickInterval = const Duration(seconds: 1), bool overlayVisible = false, Offset initialPosition = const Offset(-20, 200)})
Creates an ApiInspectorController.

Properties

hashCode int
The hash code for this object.
no setterinherited
initialPosition Offset
Initial position of the floating overlay bubble.
final
isRecording bool
Whether a capture session is currently active.
no setter
Optional navigator key, required when ApiInspectorOverlay is placed inside MaterialApp's builder (whose context is above the Navigator). Pass the same key to MaterialApp.navigatorKey.
final
overlayVisibleListenable ValueNotifier<bool>
Notifies listeners when overlay visibility changes.
final
recordingDurationSeconds int
How many seconds a capture session lasts before auto-stopping.
final
records List<ApiCallRecord>
Immutable snapshot of all captured records.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stateListenable ValueNotifier<ApiInspectorState>
Notifies listeners when the inspector state transitions.
final
tickInterval Duration
How often the recording state is updated with elapsed time / call counts.
final

Methods

dispose() → void
Disposes the controller and cancels internal timers.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onBubbleTap(BuildContext context) → void
Recommended handler for bubble tap.
reset() → void
Stops capture (if any) and returns to idle.
setOverlayVisible(bool value) → void
Controls whether the overlay bubble is visible.
toggleCapture() → void
Starts a capture when idle/done, and stops a capture when recording.
toggleOverlayVisible() → void
Toggles overlay bubble visibility.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited