SemanticsTreeWalker class
Walks the live SemanticsNode tree and captures a flat, depth-first snapshot of it as A11ySemanticsNodeInfo.
Unlike ElementTreeWalker, which reads the Element/Widget
configuration tree, this reads the tree the engine actually compiles for
assistive technology — the same data a screen reader would announce.
That's necessary for rules (SemanticLabelRule, FocusOrderRule) to
catch widgets that contribute semantics via a custom RenderObject
rather than an explicit Semantics widget.
The engine only computes this tree while something is listening for it. Callers must hold an active SemanticsHandle — e.g. via SemanticsBinding.ensureSemantics — for the duration walk is called; A11yLensOverlay manages this automatically. Without one, walk returns an empty list rather than throwing.
Constructors
- SemanticsTreeWalker()
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
walk(
BuildContext context) → List< A11ySemanticsNodeInfo> -
Returns a flattened, depth-first snapshot of the semantics subtree
below
context— mirroring ElementTreeWalker.walk's scoping, so a BuildContext passed to one behaves the same way passed to the other (e.g. via A11yReport.generate's orexpectNoA11yViolations'sfinder).
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited