byAnyAction method

SemanticsFinder byAnyAction(
  1. List<SemanticsAction> actions, {
  2. FlutterView? view,
})

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

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