TextInput class Null safety

An low-level interface to the system's text input control.

To start interacting with the system's text input control, call attach to establish a TextInputConnection between the system's text input control and a TextInputClient. The majority of commands available for interacting with the text input control reside in the returned TextInputConnection. The communication between the system text input and the TextInputClient is asynchronous.

The platform text input plugin (which represents the system's text input) and the TextInputClient usually maintain their own text editing states (TextEditingValue) separately. They must be kept in sync as long as the TextInputClient is connected. The following methods can be used to send TextEditingValue to update the other party, when either party's text editing states change:

When synchronizing the TextEditingValues, the communication may get stuck in an infinite when both parties are trying to send their own update. To mitigate the problem, only TextInputClients are allowed to alter the received TextEditingValues while platform text input plugins are to accept the received TextEditingValues unmodified. More specifically:

  • When a TextInputClient receives a new TextEditingValue from the platform text input plugin, it's allowed to modify the value (for example, apply TextInputFormatters). If it decides to do so, it must send the updated TextEditingValue back to the platform text input plugin to keep the TextEditingValues in sync.

  • When the platform text input plugin receives a new value from the connected TextInputClient, it must accept the new value as-is, to avoid sending back an updated value.

See also:


hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toString() String
A string representation of this object. [...]


operator ==(Object other) bool
The equality operator. [...]

Static Methods

attach(TextInputClient client, TextInputConfiguration configuration) TextInputConnection
Begin interacting with the text input control. [...]
finishAutofillContext({bool shouldSave = true}) → void
Finishes the current autofill context, and potentially saves the user input for future use if shouldSave is true. [...]
setChannel(MethodChannel newChannel) → void
Set the MethodChannel used to communicate with the system's text input control. [...]