flutter_perf_radar library
On-device performance and stability tracer for Flutter.
Key entry points:
- PerfRadar.init — initialise once from
main(). - PerfRadar.trace / PerfRadar.traceAsync — instrument synchronous or asynchronous operations.
- PerfRadar.start — manual start/stop span for callback-bounded code.
- PerfRadar.overlay — wrap your root widget to show the floating badge.
- TracedSubtree — counts widget subtree rebuilds via the span system.
Classes
- ErrorRecord
- An immutable record of one captured error event.
- FrameSample
- A single recorded frame's timing breakdown.
- FramesTab
- Frames tab: jank tiles + frame-time bar timeline + percentiles + worst list.
- FrameStats
- Mutable accumulator for per-frame timing data.
- FrameStatsSnapshot
- Immutable snapshot of frame timing statistics.
- PerfRadar
- On-device performance tracer. Static facade; every method is a no-op when disabled or in release builds. Never throws into the host app.
- PerfRadarConfig
- Configuration for PerfRadar.init.
- PerfRadarOverlay
- Draggable pill badge that floats above the app and opens PerfRadarScreen.
- PerfRadarScreen
- Full-screen inspector — Scaffold + AppBar wrapping PerfRadarView.
- PerfRadarView
- Tabbed body view of the Perf Radar inspector.
- RebuildCountsPanel
- Displays per-label rebuild counts extracted from the PerfRadar snapshot.
- RebuildsTab
- Rebuilds tab: per-label rebuild count rows with EXCESSIVE tagging.
- StabilityRecorder
- Mutable ring-buffer recorder for errors and stalls.
- StabilityScreen
- Full-screen Stability inspector — Scaffold + AppBar wrapping StabilityView.
- StabilitySnapshot
- Immutable point-in-time snapshot of stability counters and recent events.
- StabilityView
- Tabbed body view of the Stability inspector.
- StabilityViewBody
- The stability inspector body driven by a fixed snapshot.
- StallRecord
- An immutable record of one detected main-thread stall.
- StallWatchdog
- Detects main-thread stalls by measuring how late each timer tick arrives.
- StartupTab
- Startup sub-tab.
- TraceDetailScreen
-
Full-screen detail for a single
SpanKeyStatsSnapshot. - TracedSubtree
- Wraps child and counts how many times the subtree rebuilds.
- TracesTab
- Dense sortable Traces tab — the priority performance surface.
Functions
-
perfRadarSnapshotJson(
) → Map< String, Object?> - Assembles a complete JSON-encodable snapshot of all PerfRadar subsystems.
-
registerPerfRadarExtension(
) → void -
Registers the
ext.perf_radar.snapshotandext.perf_radar.resetFramesVM service extensions. -
spanBarGeometry(
{required double offsetFraction, required double widthFraction, required double totalWidth, double minBar = 6.0}) → ({double left, double width}) -
Computes the
(left, width)of a span bar within a track oftotalWidth.