getOffsetForCaret method

  1. @override
Offset getOffsetForCaret(
  1. TextPosition position,
  2. Rect caretPrototype
)
override

Returns the offset at which to paint the caret.

Valid only after layout.

Implementation

/// Returns the offset at which to paint the caret.
///
/// Valid only after [layout].
@override
Offset getOffsetForCaret(TextPosition position, Rect caretPrototype) {
  assert(!debugNeedsLayout);
  _layoutTextWithConstraints(constraints);
  return _textPainter.getOffsetForCaret(position, caretPrototype);
}