byLabel method

SemanticsFinder byLabel(
  1. Pattern label, {
  2. FlutterView? view,
})

Finds any SemanticsNodes that has a SemanticsNode.label that matches the given label.

The view provided will be used to determine the semantics tree where the search will be evaluated. If not provided, the search will be evaluated against the semantics tree of WidgetTester.view.

Implementation

SemanticsFinder byLabel(Pattern label, {FlutterView? view}) {
  return byPredicate(
    (SemanticsNode node) => _matchesPattern(node.label, label),
    describeMatch: (Plurality plurality) => '${switch (plurality) {
      Plurality.one => 'SemanticsNode',
      Plurality.zero || Plurality.many => 'SemanticsNodes',
    }} with label "$label"',
    view: view,
  );
}