StartupDetector class

Detects slow app startup using metrics captured by Sleuth.init.

Structural Detector — operates one-shot in prepareScan to read Sleuth.startupMetrics. The element-walking methods are no-ops because startup timing comes from FrameTiming and wall-clock timestamps, not the widget tree.

Fires a single issue type:

The issue is one-shot — once detected on the first scan after startup, it persists for the session but is not re-evaluated. This avoids stale re-detection on hot restart where Sleuth.init guards against double-measurement.

Inheritance
Mixed-in types
Annotations
  • @experimental

Constructors

StartupDetector({int ttffWarningMs = 1500, int ttffCriticalMs = 3000})

Properties

description → String
Short description of what this detector checks.
finalinherited
evaluated → bool
Whether the detector has judged the first-frame metrics, with or without an issue. False until Sleuth.startupMetrics exists and a scan has read it.
no setter
hashCode → int
The hash code for this object.
no setterinherited
highlights → List<WidgetHighlight>
Highlight candidates collected during the last scan. Empty for detectors that don't produce visual highlights.
no setterinherited
isEnabled ↔ bool
Whether this detector is currently active.
getter/setter pairoverride
issues → List<PerformanceIssue>
Current list of detected issues. Reset each analysis cycle.
no setteroverride
key → String?
Stable identifier for config-driven gating of custom detectors.
finalinherited
lifecycle → DetectorLifecycle
Lifecycle classification determining data source requirements.
finalinherited
name → String
Human-readable name of this detector (e.g., "Frame Timing").
finalinherited
requiresTreeScan → bool
Whether this detector scans the widget/render tree.
no setterinherited
requiresVm → bool
Whether this detector needs VM service data to function. DetectorLifecycle.runtime detectors benefit from VM data but don't require it.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
ttffCriticalMs → int
Critical threshold in ms. Applied to StartupMetrics.ttffMs. See ttffWarningMs for the measurement-window rationale.
final
ttffWarningMs → int
Warning threshold in ms. Applied to StartupMetrics.ttffMs, which is measured from Sleuth.init (Dart entry) to first-frame raster-finish. The native pre-Dart phase — iOS (dyld, UIApplicationMain, AppDelegate, FlutterEngine creation) or Android (Zygote fork, Application.onCreate, ContentProvider init, FlutterActivity, FlutterEngine creation), then Dart VM bootstrap + AOT snapshot load on both — is excluded by design. These thresholds are calibrated for the portion Dart code can actually move. See StartupMetrics.engineTtffMs for the flutter run --trace-startup -equivalent engine-level number.
final
type → DetectorType
The detector type identifier used for configuration.
finalinherited
validationMetadata → DetectorMetadata
Metadata for this detector. Must be non-null on shipping detectors — the audit test gates this.
no setteroverride
vmConnected ← bool
Update VM connectivity state.
no getterinherited

Methods

afterElement(Element element) → void
Called after an element's children have all been visited.
inherited
checkElement(Element element) → void
Check a single element during the unified tree walk.
override
dispose() → void
Dispose of any resources held by this detector.
override
evaluateNow() → void
Triggers issue evaluation using whatever data has been staged.
inherited
finalizeScan() → void
Finalise the scan: process accumulated data and create issues.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyWalkCompleted() → void
Called when the tree walk completed without exceptions.
inherited
prepareScan(BuildContext context) → void
Prepare for a new scan cycle. Called once before the unified tree walk.
override
processFrame(FrameStats frame) → void
Process one presented frame from FrameTiming.
inherited
processTimelineData(ParsedTimelineData data) → void
Process VM timeline data.
inherited
scanTree(BuildContext context) → void
Scan the widget/render tree for issues.
inherited
toString() → String
A string representation of this object.
inherited
updateDebugSnapshot(DebugSnapshot snapshot) → void
Called with debug callback data when available.
inherited

Operators

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