widgetWithSemanticLabel method
Implementation
Finder widgetWithSemanticLabel(Type widgetType, String semanticLabel,
{bool skipOffstage = true, Matcher? semanticMatcher}) {
final parentWidget = find.ancestor(
of: find.bySemanticsLabel(semanticLabel, skipOffstage: skipOffstage),
matching: find.byType(widgetType, skipOffstage: skipOffstage),
);
if (semanticMatcher != null) {
final semanticWidget = find.descendant(
of: parentWidget, matching: bySemanticsLabel(semanticLabel));
final widgetSemantics = currentWorld.tester.getSemantics(semanticWidget);
expect(widgetSemantics, semanticMatcher);
}
return parentWidget;
}