performSemanticsAction method

  1. @override
void performSemanticsAction(
  1. SemanticsActionEvent action
)
override

Called whenever the platform requests an action to be performed on a SemanticsNode.

This callback is invoked when a user interacts with the app via an accessibility service (e.g. TalkBack and VoiceOver) and initiates an action on the focused node.

Bindings that mixin the SemanticsBinding must implement this method and perform the given action on the SemanticsNode specified by ui.SemanticsActionEvent.nodeId.

See dart:ui.PlatformDispatcher.onSemanticsActionEvent.

Implementation

@override
void performSemanticsAction(SemanticsActionEvent action) {
  // Due to the asynchronicity in some screen readers (they may not have
  // processed the latest semantics update yet) this code is more forgiving
  // and actions for views/nodes that no longer exist are gracefully ignored.
  _viewIdToRenderView[action.viewId]?.owner?.semanticsOwner?.performAction(action.nodeId, action.type, action.arguments);
}