RuntimeInsightOverlayController class

A controller for RuntimeInsightOverlay that allows changing its state and configuration programmatically from anywhere in the app.

Use the static instance for global access, or create a dedicated instance and pass it to the overlay via the controller parameter.

State control

final ctrl = RuntimeInsightOverlayController.instance;
ctrl.hide();
ctrl.minimize();
ctrl.pause();
ctrl.opacity = 0.6;

Configuration override

Any property set on the controller overrides the corresponding widget constructor value. Leaving it null keeps the widget default.

ctrl.width = 320;
ctrl.showPauseButton = false;
ctrl.strings = RuntimeInsightOverlayStrings.english();

Stream access

ctrl.snapshotStream.listen((snapshot) {
  print('CPU: ${snapshot.cpuPercent}%');
});

final last = ctrl.latestSnapshot;
final all  = ctrl.history;
Inheritance

Constructors

RuntimeInsightOverlayController({bool visible = true, bool minimized = false, bool paused = false, double opacity = 0.95, double? width, double? height, int? maxPoints, double? minimizedSize, EdgeInsets? margin, Color? backgroundColor, bool? showCloseButton, bool? showPauseButton, bool? showOpacitySlider, bool? showMinimizeButton, bool? allowDrag, RuntimeInsightOverlayStrings? strings, VoidCallback? onClose, AppResourceMonitoringConfig? monitoringConfig})
Creates a controller with the given initial values.

Properties

allowDrag bool?
Whether the overlay can be dragged. null keeps the widget default (true).
getter/setter pair
backgroundColor Color?
Background colour override for the overlay panel.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
height double?
Overlay panel height. null keeps the widget default (300).
getter/setter pair
history List<AppResourceSnapshot>
An unmodifiable copy of the snapshot history currently held by the overlay.
no setter
latestSnapshot AppResourceSnapshot?
The most recent AppResourceSnapshot, or null if none arrived yet.
no setter
margin EdgeInsets?
Margin around the overlay. null keeps the widget default (12 all).
getter/setter pair
maxPoints int?
Maximum data-points shown in the charts. null keeps the widget default (60).
getter/setter pair
minimized bool
Whether the overlay is in minimized (bubble) mode.
getter/setter pair
minimizedSize double?
Diameter of the minimized circle bubble. null keeps the widget default (56).
getter/setter pair
monitoringConfig AppResourceMonitoringConfig?
Monitoring configuration override. When set, the overlay restarts monitoring with this config.
getter/setter pair
onClose VoidCallback?
Called when the close button is tapped. Overrides the widget callback.
getter/setter pair
opacity double
The overlay background opacity (clamped between 0.0 and 1.0).
getter/setter pair
paused bool
Whether the monitoring data feed is paused.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showCloseButton bool?
Whether to show the close button. null keeps the widget default (true).
getter/setter pair
showMinimizeButton bool?
Whether to show the minimize button. null keeps the widget default (true).
getter/setter pair
showOpacitySlider bool?
Whether to show the opacity slider. null keeps the widget default (true).
getter/setter pair
showPauseButton bool?
Whether to show the pause/resume button. null keeps the widget default (true).
getter/setter pair
snapshotStream Stream<AppResourceSnapshot>
A broadcast stream of AppResourceSnapshot events, fed by the overlay.
no setter
strings RuntimeInsightOverlayStrings?
Localised strings for the overlay UI.
getter/setter pair
visible bool
Whether the overlay is visible.
getter/setter pair
width double?
Overlay panel width. null keeps the widget default (280).
getter/setter pair

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
addSnapshot(AppResourceSnapshot snapshot, {required int maxPoints}) → void
Pushes a new snapshot into the controller.
clearHistory() → void
Clears the snapshot history. Called internally when the overlay restarts monitoring.
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
override
expand() → void
Expands the overlay to the full panel.
hide() → void
Hides the overlay.
minimize() → void
Minimizes the overlay to the CPU bubble.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
pause() → void
Pauses the data feed.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
resume() → void
Resumes the data feed.
show() → void
Shows the overlay.
toggleMinimized() → void
Toggles between minimized and expanded.
togglePause() → void
Toggles between paused and running.
toggleVisibility() → void
Toggles overlay visibility.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

instance RuntimeInsightOverlayController
Global shared instance for convenient static access.
final