moveSelectionToStart method Null safety

void moveSelectionToStart(
  1. SelectionChangedCause cause
)

Move the current selection to the start of the field.

The given SelectionChangedCause indicates the cause of this change and will be passed to onSelectionChanged.

See also:

Implementation

void moveSelectionToStart(SelectionChangedCause cause) {
  assert(selection != null);

  if (selection!.isCollapsed && selection!.extentOffset == 0) {
    return;
  }
  const TextSelection nextSelection = TextSelection.collapsed(offset: 0);
  _setSelection(nextSelection, cause);
}