pressDocumentHomeKey method

void pressDocumentHomeKey({
  1. bool isShiftPressed = false,
})

Moves the cursor to the beginning of the document.

If isShiftPressed is true, extends the selection to the document start.

Implementation

void pressDocumentHomeKey({bool isShiftPressed = false}) {
  if (isShiftPressed) {
    setSelectionSilently(
      TextSelection(baseOffset: selection.baseOffset, extentOffset: 0),
    );
  } else {
    setSelectionSilently(TextSelection.collapsed(offset: 0));
  }
}