getBoxesForSelection method

List<TextBox> getBoxesForSelection (
  1. TextSelection selection
)

Returns a list of rects that bound the given selection.

A given selection might have more than one rect if this text painter contains bidirectional text because logically contiguous text might not be visually contiguous.

Valid only after layout.

Implementation

List<ui.TextBox> getBoxesForSelection(TextSelection selection) {
  assert(!debugNeedsLayout);
  _layoutTextWithConstraints(constraints);
  return _textPainter.getBoxesForSelection(selection);
}