setTextSelection method

void setTextSelection(
  1. TextSelection t
)

Implementation

void setTextSelection(TextSelection t) {
  if (textSelection == t) {
    return;
  }

  final containsSelection = containsTextSelection();
  if (attached && containsCursor()) {
    cursorCont.removeListener(markNeedsLayout);
    cursorCont.color.removeListener(safeMarkNeedsPaint);
  }

  textSelection = t;
  _selectedRects = null;
  _containsCursor = null;
  if (attached && containsCursor()) {
    cursorCont.addListener(markNeedsLayout);
    cursorCont.color.addListener(safeMarkNeedsPaint);
  }

  if (containsSelection || containsTextSelection()) {
    safeMarkNeedsPaint();
  }
}