replacedText method
Implementation
TextEditingValue replacedText(String newText) {
if (newText == text) {
return this;
}
final rangeAfter = newText.getChangedRange(
text,
attributeChangeTo: TextAffinity.upstream,
);
return TextEditingValue(
text: newText,
selection: TextSelection.collapsed(offset: rangeAfter.start),
);
}