onDidGainAccessibilityFocus property Null safety

VoidCallback? onDidGainAccessibilityFocus

The handler for SemanticsAction.didGainAccessibilityFocus.

This handler is invoked when the node annotated with this handler gains the accessibility focus. The accessibility focus is the green (on Android with TalkBack) or black (on iOS with VoiceOver) rectangle shown on screen to indicate what element an accessibility user is currently interacting with.

The accessibility focus is different from the input focus. The input focus is usually held by the element that currently responds to keyboard inputs. Accessibility focus and input focus can be held by two different nodes!

See also:

Implementation

VoidCallback? get onDidGainAccessibilityFocus => _onDidGainAccessibilityFocus;
void onDidGainAccessibilityFocus=(VoidCallback? handler)

Implementation

set onDidGainAccessibilityFocus(VoidCallback? handler) {
  if (_onDidGainAccessibilityFocus == handler)
    return;
  final bool hadValue = _onDidGainAccessibilityFocus != null;
  _onDidGainAccessibilityFocus = handler;
  if ((handler != null) != hadValue)
    markNeedsSemanticsUpdate();
}