addTab method
void
addTab()
Appends a tab at the TextSelection.baseOffset and
moves the selection-offset at previous offset + tab size
.
Implementation
void addTab() {
final int oldOffset = this.selection.baseOffset;
String replacement;
if (tabSize != 1) {
replacement = ' ' * tabSize;
} else {
replacement = '\t';
}
text = text.replaceRange(oldOffset, oldOffset, replacement);
this.selection = TextSelection.fromPosition(
TextPosition(
offset: oldOffset + tabSize,
),
);
}