session/local/element_semantics library

Functions

boundsFor(Element element) → UiBounds?
describeElement({required Element element, required String elementId, required String? testId, required AssertionEngine assertions, required WidgetTester tester, required bool includeBounds, bool useSemantics = true, bool registerRouteDependency = true}) → UiElement
Builds a semantic UiElement snapshot from a live Flutter Element.
findPrimaryControlDescendant(Element element) → Element?
Nearest primary-control descendant, if any.
hasPrimaryControlAncestor(Element element) → bool
True when a primary control already wraps element (nested InkWell, etc.).
inferSemanticRole(Element element, String type) → String
inferWidgetType(Element element) → String
inViewport(WidgetTester tester, UiBounds bounds) → bool
isActionableControl(Element element) → bool
Interactive controls suitable as the primary target of a text locator. Excludes bare Semantics wrappers that may span multiple controls.
isCardScopeHost(Element element) → bool
Material Card or bordered visual panel that observes as card.
isDecorativeGlyphCaption(String? text) → bool
Bullet / password-mask / icon-font glyphs — not observe text or text=.
isElementGeometricallyVisible(Element element, WidgetTester tester) → bool
Geometry and visibility queries shared by observation and assertions.
isNestedActionableElement(Element element) → bool
When a keyed Ensemble wrapper is typed generically, prefer the logical control it owns (Checkbox → checkbox, TextField → textInput, …).
isNestedContentMediaElement(Element element) → bool
Media nested under a tappable card/row (device art, status glyphs, …).
isNestedContentTextElement(Element element) → bool
Caption / badge Text nested under a tappable card, button, or row.
isObservableTextElement(Element element) → bool
User-facing text that should remain observable even when it is nested below a control host. The tree builder removes redundant control captions after collection, so filtering nested text here can otherwise hide meaningful status labels (for example, a badge rendered inside a custom row/control).
isPrimaryControlElement(Element element) → bool
True when element's widget is the logical control (not a descendant).
isRedundantLeafUnderKeyedIconShell(Element element) → bool
Leaf text/media under a keyed compact icon shell (back button, etc.).
isSemanticLocatorCandidate(Element element) → bool
True for the element that owns user-facing semantics, excluding the many implementation descendants that resolve to the same merged semantics node.
isStandaloneMediaElement(Element element) → bool
Visible image / SVG / GIF / Lottie host (not an inner leaf under Ensemble*).
isStandaloneTextElement(Element element) → bool
Non-empty Text/RichText that is not under a primary control.
isTextLocatorCandidate(Element element) → bool
isUnderOffstageAncestor(Element element) → bool
Whether element is retained by an Offstage subtree rather than part of the current rendered screen.
isVisualCardContainerElement(Element element) → bool
Non-interactive visual card chrome (bordered / Material Card panel).
looksSecure(Element element) → bool
readCardEnabled(Element element) → bool?
Enabled for observed card rows — only when the card itself is tappable.
readChecked(Element element) → bool?
readControlLabel(Element element, WidgetTester tester) → String?
Label for a control: InputDecoration label, then semantics (not the hint).
readControlLabelWithoutSemantics(Element element) → String?
Widget-field label only — never calls WidgetTester.getSemantics.
readDropdownOptions(Element element) → List<String>
Dropdown option labels from widget items / menu entries.
readEnabled(Element element) → bool?
readEnabledFromCompactTapAncestor(Element element) → bool?
Enabled for a leaf icon/glyph under compact tappable chrome.
readHint(Element element) → String?
InputDecoration / Cupertino placeholder — never used as readText value.
readIconButtonEnabled(Element element) → bool?
Enabled state for observed icon rows — only when this is an icon button.
readIconName(Element element) → String?
User-provided name for an icon (id is separate). Never invents Material names.
readSelected(WidgetTester tester, Element element) → bool?
Reads the selected semantics flag when the element exposes one. Semantics-disabled snapshots leave the value unknown.
readSemanticsLabel(WidgetTester tester, Element element) → String?
readText(Element element) → String?
resolveObservedWidgetType(Element element, {required String? testId}) → String
visibleScreenIdentifier(WidgetTester tester) → String?
Identifies the screen that owns the visible widget tree.