byAnyFlag method

SemanticsFinder byAnyFlag(
  1. List<SemanticsFlag> flags, {
  2. FlutterView? view,
})

Finds any SemanticsNodes that has at least one of the given SemanticsFlags.

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 byAnyFlag(List<SemanticsFlag> flags, {FlutterView? view}) {
  final int flagsInt = flags.fold(0, (int value, SemanticsFlag flag) => value | flag.index);
  return byPredicate(
    (SemanticsNode node) => node.getSemanticsData().flags & flagsInt != 0,
    describeMatch: (Plurality plurality) => '${switch (plurality) {
      Plurality.one => 'SemanticsNode',
      Plurality.zero || Plurality.many => 'SemanticsNodes',
    }} with any of the following flags: $flags',
    view: view,
  );
}