TextEditingController class

Controls the state of a TextField.

Whenever the user modifies a text field with an associated TextEditingController, the text field updates model and the controller notifies its listeners.

Inheritance
Implemented types

Constructors

TextEditingController({String? text, TextInputModel? model})

Properties

canRedo bool
Whether there is an undone edit available to redo.
no setter
canUndo bool
Whether there is an edit available to undo.
no setter
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
model ↔ TextInputModel
The current TextInputModel managed by this controller.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selection TextSelection
The current selection.
getter/setter pair
text String
The current text being edited.
getter/setter pair
value TextEditingValue
The current value of the object.
getter/setter pairoverride-getter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
clear() → void
Clears the text.
clearHistory() → void
Clears all undo and redo history.
deleteBackward({bool word = false, bool coalesce = false}) bool
Deletes backward from the cursor or removes the current selection.
deleteForward({bool word = false, bool coalesce = false}) bool
Deletes forward from the cursor or removes the current selection.
deleteSelection() bool
Deletes the current selection.
dispose() → void
Discards any resources used by the object.
inherited
insertText(String text, {bool replaceSelection = true, bool coalesce = false}) → void
Inserts text at the cursor, optionally replacing the selection.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
pushHistoryBoundary() → void
Starts a fresh undo step for the next edit.
redo() bool
Reapplies the most recently undone edit state and notifies listeners.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
replaceSelection(String text) → void
Replaces the current selection, or inserts at the cursor if collapsed.
selectAll() → void
Selects all text.
toString() String
A string representation of this object.
inherited
undo() bool
Restores the previous edit state and notifies listeners.
update(Msg msg) → Cmd?
Updates the model using the provided msg.

Operators

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