RuntimeInsightOverlay class

A draggable overlay widget that displays real-time app resource charts.

Place it in a Stack to visualise CPU, RAM, disk and network metrics. The overlay supports drag, pause/resume, opacity control and position persistence via SharedPreferences.

If no stream is provided, the widget automatically calls RuntimeInsight.startMonitoring and manages its lifecycle.

Use controller (or the static RuntimeInsightOverlayController.instance) to change any configuration or read streams from anywhere:

final ctrl = RuntimeInsightOverlayController.instance;
ctrl.hide();
ctrl.minimize();
ctrl.opacity = 0.6;
ctrl.width = 320;
ctrl.showPauseButton = false;

ctrl.snapshotStream.listen((s) => print(s.cpuPercent));
Inheritance

Constructors

RuntimeInsightOverlay({Key? key, Stream<AppResourceSnapshot>? stream, AppResourceMonitoringConfig? config, int maxPoints = 60, double width = 280, double height = 300, bool showCloseButton = true, bool showPauseButton = true, bool showOpacitySlider = true, bool allowDrag = true, String? persistenceKey, bool persistPosition = true, bool persistOpacity = true, RuntimeInsightOverlayStrings? strings, VoidCallback? onClose, EdgeInsets margin = const EdgeInsets.all(12), Color? backgroundColor, bool showMinimizeButton = true, double minimizedSize = 56, bool initiallyMinimized = false, RuntimeInsightOverlayController? controller})
const

Properties

allowDrag bool
Whether the overlay can be dragged.
final
backgroundColor Color?
Background colour override for the overlay panel.
final
config AppResourceMonitoringConfig?
Monitoring configuration used when the overlay creates its own stream.
final
controller RuntimeInsightOverlayController?
Optional controller for programmatic state and configuration changes.
final
hashCode int
The hash code for this object.
no setterinherited
height double
Widget height.
final
initiallyMinimized bool
Whether the overlay starts in minimized mode.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
margin EdgeInsets
Margin around the overlay.
final
maxPoints int
Maximum number of data points shown in the charts.
final
minimizedSize double
Diameter of the minimized circle bubble.
final
onClose VoidCallback?
Called when the close button is tapped.
final
persistenceKey String?
Key used for persisting position and opacity in SharedPreferences.
final
persistOpacity bool
Whether to persist the overlay opacity across sessions.
final
persistPosition bool
Whether to persist the overlay position across sessions.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showCloseButton bool
Whether to show the close button.
final
showMinimizeButton bool
Whether to show the minimize button in the header.
final
showOpacitySlider bool
Whether to show the opacity slider.
final
showPauseButton bool
Whether to show the pause/resume button.
final
stream Stream<AppResourceSnapshot>?
An external monitoring stream. If null, the overlay creates its own.
final
strings RuntimeInsightOverlayStrings?
Localised strings for the overlay UI.
final
width double
Widget width.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<RuntimeInsightOverlay>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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