isSelectionWithinTextBounds method Null safety

bool isSelectionWithinTextBounds(
  1. TextSelection selection
)

Check that the selection is inside of the bounds of text.

Implementation

bool isSelectionWithinTextBounds(TextSelection selection) {
  return selection.start <= text.length && selection.end <= text.length;
}