selectLineAtPosition method

  1. @override
TextSelection selectLineAtPosition(
  1. TextPosition position
)
override

Implementation

@override
TextSelection selectLineAtPosition(TextPosition position) {
  final line = getLineAtOffset(position);

  // When long-pressing past the end of the text, we want a collapsed cursor.
  if (position.offset >= line.end) {
    return TextSelection.fromPosition(position);
  }
  return TextSelection(baseOffset: line.start, extentOffset: line.end);
}