getSemantics method

SemanticsNode getSemantics(
  1. FinderBase<Element> finder
)

Attempts to find the SemanticsNode of first result from finder.

If the object identified by the finder doesn't own it's semantic node, this will return the semantics data of the first ancestor with semantics. The ancestor's semantic data will include the child's as well as other nodes that have been merged together.

If the SemanticsNode of the object identified by the finder is force-merged into an ancestor (e.g. via the MergeSemantics widget) the node into which it is merged is returned. That node will include all the semantics information of the nodes merged into it.

Will throw a StateError if the finder returns more than one element or if no semantics are found or are not enabled.

Implementation

// TODO(pdblasi-google): Deprecate this and point references to semantics.find. See https://github.com/flutter/flutter/issues/112670.
SemanticsNode getSemantics(finders.FinderBase<Element> finder) => semantics.find(finder);