getFullWidthForCaret method

double? getFullWidthForCaret(
  1. TextPosition position,
  2. Rect caretPrototype
)

Returns the strut bounded width of the glyph at the given position.

Valid only after layout has been called.

Implementation

double? getFullWidthForCaret(TextPosition position, Rect caretPrototype) {
  if (position.offset < 0) {
    return null;
  }
  return switch (_computeCaretMetrics(position)) {
    _LineCaretMetrics(:final double fullWidth) => fullWidth,
    _EmptyLineCaretMetrics() => null,
  };
}