getBoxesForSelection method Null safety

List<TextBox> getBoxesForSelection(
  1. TextSelection selection,
  2. {BoxHeightStyle boxHeightStyle = ui.BoxHeightStyle.tight,
  3. BoxWidthStyle boxWidthStyle = ui.BoxWidthStyle.tight}

Returns a list of rects that bound the given selection.

The boxHeightStyle and boxWidthStyle arguments may be used to select the shape of the TextBoxs. These properties default to ui.BoxHeightStyle.tight and ui.BoxWidthStyle.tight respectively and must not be null.

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.

Leading or trailing newline characters will be represented by zero-width Textboxes.

The method only returns TextBoxes of glyphs that are entirely enclosed by the given selection: a multi-code-unit glyph will be excluded if only part of its code units are in selection.


List<TextBox> getBoxesForSelection(
  TextSelection selection, {
  ui.BoxHeightStyle boxHeightStyle = ui.BoxHeightStyle.tight,
  ui.BoxWidthStyle boxWidthStyle = ui.BoxWidthStyle.tight,
}) {
  assert(boxHeightStyle != null);
  assert(boxWidthStyle != null);
  return _paragraph!.getBoxesForRange(
    boxHeightStyle: boxHeightStyle,
    boxWidthStyle: boxWidthStyle,