TextInputFormatter class Null safety
Text modification should only be applied when text is being committed by the IME and not on text under composition (i.e., only when TextEditingValue.composing is collapsed).
See also the FilteringTextInputFormatter, a subclass that removes characters that the user tries to enter if they do, or do not, match a given pattern (as applicable).
Handling emojis and other complex characters
It's important to always use characters when dealing with user input text that may contain complex characters. This will ensure that extended grapheme clusters and surrogate pairs are treated as single characters, as they appear to the user.
For example, when finding the length of some user input, use
string.characters.length. Do NOT use
string.length or even
string.runes.length. For the complex character "👨👩👦", this
appears to the user as a single character, and
intuitively returns 1. On the other hand,
string.length returns 8, and
string.runes.length returns 5!
TextEditingValue oldValue, TextEditingValue newValue) → TextEditingValue
- Called when text is being typed or cut/copy/pasted in the EditableText.
Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
) → String
A string representation of this object.