moveSelectionLeftByWord method Null safety

void moveSelectionLeftByWord(
  1. SelectionChangedCause cause,
  2. [bool includeWhitespace = true]

Move the current selection to the previous start of a word.

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

By default, includeWhitespace is set to true, meaning that whitespace can be considered a word in itself. If set to false, the selection will be extended past any whitespace and the first word following the whitespace.

See also:


void moveSelectionLeftByWord(SelectionChangedCause cause, [bool includeWhitespace = true]) {
  assert(selection != null);

  // When the text is obscured, the whole thing is treated as one big word.
  if (obscureText) {
    return moveSelectionToStart(cause);

    _textLayoutLastMaxWidth == constraints.maxWidth &&
    _textLayoutLastMinWidth == constraints.minWidth,
    'Last width ($_textLayoutLastMinWidth, $_textLayoutLastMaxWidth) not the same as max width constraint (${constraints.minWidth}, ${constraints.maxWidth}).',
  final TextSelection nextSelection = _moveGivenSelectionLeftByWord(
  if (nextSelection == selection) {
  _setSelection(nextSelection, cause);