onSetSelection property

SetSelectionHandler onSetSelection

The handler for SemanticsAction.setSelection.

This handler is invoked when the user either wants to change the currently selected text in a text field or change the position of the cursor.

TalkBack users can trigger this handler by selecting "Move cursor to beginning/end" or "Select all" from the local context menu.

Implementation

SetSelectionHandler get onSetSelection => _onSetSelection;
void onSetSelection= (SetSelectionHandler handler)

Implementation

set onSetSelection(SetSelectionHandler handler) {
  if (_onSetSelection == handler)
    return;
  final bool hadValue = _onSetSelection != null;
  _onSetSelection = handler;
  if ((handler != null) != hadValue)
    markNeedsSemanticsUpdate();
}