getBoxesForSelection method Null safety

List<Rect> getBoxesForSelection(
  1. TextSelection selection
)

Returns a list of rects that bound the given selection.

See TextPainter.getBoxesForSelection for more details.

Implementation

List<Rect> getBoxesForSelection(TextSelection selection) {
  _computeTextMetricsIfNeeded();
  return _textPainter.getBoxesForSelection(selection)
                     .map((TextBox textBox) => textBox.toRect().shift(_paintOffset))
                     .toList();
}