TextEditingModel class final

Pure editing operations over TextEditingValue.

Public offsets are Dart string (UTF-16 code unit) offsets, like every other text API in Dart, but every operation snaps to extended-grapheme-cluster boundaries before mutating. That keeps emoji, CJK, and combining sequences from being split by cursor movement or deletion.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

killRing ↔ String
The shared kill ring (most recent kill). Resettable for tests.
getter/setter pair

Static Methods

backspace(TextEditingValue value) → TextEditingValue
clearComposing(TextEditingValue value) → TextEditingValue
commitComposing(TextEditingValue value, {String? text, bool singleLine = false}) → TextEditingValue
Commits the current composing range.
delete(TextEditingValue value) → TextEditingValue
graphemeColumn(String text, int lineStart, int offset) → int
insert(TextEditingValue value, String text, {bool singleLine = false}) → TextEditingValue
killRange(TextEditingValue value, int start, int end, {bool captureToKillRing = true}) → TextEditingValue
Cuts [start, end) into the kill ring and returns the value with that span removed (caret at the cut point). Empty spans are a no-op.
killToLineEnd(TextEditingValue value, {bool captureToKillRing = true}) → TextEditingValue
Ctrl+K: kill from the caret to the end of the line; if already at the line end, kill the trailing newline (joining the next line) — emacs behavior.
killToLineStart(TextEditingValue value, {bool captureToKillRing = true}) → TextEditingValue
Ctrl+U: kill from the start of the line to the caret.
killWordLeft(TextEditingValue value, {bool captureToKillRing = true}) → TextEditingValue
Ctrl+W: kill the word before the caret.
lineEndOffset(String text, int offset) → int
lineStartOffset(String text, int offset) → int
moveLeft(TextEditingValue value, {bool extend = false}) → TextEditingValue
moveLineDown(TextEditingValue value, {bool extend = false}) → TextEditingValue
moveLineUp(TextEditingValue value, {bool extend = false}) → TextEditingValue
moveRight(TextEditingValue value, {bool extend = false}) → TextEditingValue
moveToEnd(TextEditingValue value, {bool extend = false}) → TextEditingValue
moveToLineEnd(TextEditingValue value, {bool extend = false}) → TextEditingValue
moveToLineStart(TextEditingValue value, {bool extend = false}) → TextEditingValue
moveToStart(TextEditingValue value, {bool extend = false}) → TextEditingValue
moveWordLeft(TextEditingValue value, {bool extend = false}) → TextEditingValue
moveWordRight(TextEditingValue value, {bool extend = false}) → TextEditingValue
nextGraphemeBoundary(String text, int offset) → int
nextWordBoundary(String text, int offset) → int
normalizeMultilineInput(String text) → String
Canonicalizes clipboard line endings for a multiline editing value.
normalizeSingleLineInput(String text) → String
offsetForGraphemeColumn(String text, int lineStart, int lineEnd, int column) → int
prepareInput(String text, {required bool singleLine, bool preserveText = false}) → String
Canonicalizes text arriving from outside the model — typed input, paste, an IME commit, a programmatic write.
previousGraphemeBoundary(String text, int offset) → int
previousWordBoundary(String text, int offset) → int
replaceRange(TextEditingValue value, TextRange range, String replacement, {bool singleLine = false}) → TextEditingValue
replaceSelection(TextEditingValue value, String replacement) → TextEditingValue
setComposingRange(TextEditingValue value, TextRange range) → TextEditingValue
snapOffsetToGraphemeBoundary(String text, int offset) → int
updateComposing(TextEditingValue value, String text, {bool singleLine = false}) → TextEditingValue
Replaces the active composing range with text and marks the inserted text as the new composing range.
yank(TextEditingValue value, {bool singleLine = false}) → TextEditingValue
Ctrl+Y: insert the kill ring at the caret (replacing any selection).