ImageMemoryDetector class
Detects images decoded at a larger resolution than they are shown.
Structural Detector — pairs each Image with the RawImage it
builds, reads the decoded ui.Image size, the render box size, and the
device pixel ratio, and reports images whose decode is well above the
physical pixels the box needs. Widgets showing the same decode (one
image cache entry, so ui.Image.isCloneOf) count it once, against
the largest size any of them needs. The ui.Image handles are held
only for the scan that reads them.
- Inheritance
-
- Object
- BaseDetector
- ImageMemoryDetector
- Mixed-in types
- Annotations
-
- @experimental
Constructors
- ImageMemoryDetector({double oversizeRatio = 1.5, int minWastedBytes = 1 << 20, int criticalWastedBytes = 16 << 20})
Properties
- criticalWastedBytes → int
-
Critical severity at or above this many wasted bytes in total.
final
- description → String
-
Short description of what this detector checks.
finalinherited
- 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 setteroverride
- 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
- minWastedBytes → int
-
The issue emits when qualifying images waste at least this many bytes
in total.
final
- name → String
-
Human-readable name of this detector (e.g., "Frame Timing").
finalinherited
- oversizeRatio → double
-
An image qualifies when its decode is at least this many times the
needed physical pixels on its smaller axis.
final
- 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
- type → DetectorType
-
The detector type identifier used for configuration.
finalinherited
-
uncachedImages
→ List<
UncachedImageInfo> -
Oversized decodes found in the last scan, one entry per decode
however many widgets show it, before the total-bytes gate.
no setter
- 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.
override
-
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
Static Methods
-
extractSourceName(
ImageProvider< Object> provider) → String - Extract a human-readable name from an ImageProvider.