setContent method
Replace the whole styled content in one shot.
Implementation
void setContent(String newText, List<UStyleSpan> newSpans, {int? caret}) {
value = TextEditingValue(
text: newText,
selection: TextSelection.collapsed(offset: (caret ?? newText.length).clamp(0, newText.length)),
);
spans
..clear()
..addAll(newSpans.map((UStyleSpan sp) => sp.copy()));
normalize();
notifyListeners();
}