byFlag method

SemanticsFinder byFlag(
  1. SemanticsFlag flag, {
  2. FlutterView? view,
})

Finds any SemanticsNodes that has the given SemanticsFlag.

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 byFlag(SemanticsFlag flag, {FlutterView? view}) {
  return byPredicate(
    (SemanticsNode node) => node.hasFlag(flag),
    describeMatch: (Plurality plurality) => '${switch (plurality) {
      Plurality.one => 'SemanticsNode',
      Plurality.zero || Plurality.many => 'SemanticsNodes',
    }} with flag "$flag"',
    view: view,
  );
}