readOwnedWidgetLocatorId function

String? readOwnedWidgetLocatorId(
  1. Element element
)

Id attached specifically to element (observe / hints).

Prefer finderForLocatorId for tap/enterText/wait — that path is ValueKey only so it matches historical find.byKey(ValueKey(id)).

Implementation

String? readOwnedWidgetLocatorId(Element element) {
  final testId = readValueKeyLocatorId(element);
  if (testId != null) return testId;

  final invokableId = readInvokableLocatorId(element);
  if (invokableId == null) return null;
  if (ancestorClaimsLocatorId(element, invokableId)) return null;
  return invokableId;
}