getLineAtOffset method Null safety
- TextPosition position
override
Return a TextSelection containing the line of the given TextPosition.
Implementation
@override
TextSelection getLineAtOffset(TextPosition position) {
debugAssertLayoutUpToDate();
final TextRange line = _textPainter.getLineBoundary(position);
// If text is obscured, the entire string should be treated as one line.
if (obscureText) {
return TextSelection(baseOffset: 0, extentOffset: _plainText.length);
}
return TextSelection(baseOffset: line.start, extentOffset: line.end);
}