WhitelistingTextInputFormatter class
A TextInputFormatter that allows only the insertion of whitelisted characters patterns.
Since this formatter only removes characters from the text, it attempts to preserve the existing TextEditingValue.selection to values it would now fall at with the removed characters.
See also:
- BlacklistingTextInputFormatter, which uses a blacklist instead of a whitelist.
- Inheritance
- Object
- TextInputFormatter
- WhitelistingTextInputFormatter
Constructors
- WhitelistingTextInputFormatter(Pattern whitelistedPattern)
- Creates a formatter that allows only the insertion of whitelisted characters patterns. [...]
Properties
- whitelistedPattern → Pattern
-
A Pattern to extract all instances of allowed characters. [...]
final
- 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
Methods
-
formatEditUpdate(
TextEditingValue oldValue, TextEditingValue newValue) → TextEditingValue -
Called when text is being typed or cut/copy/pasted in the EditableText. [...]
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited
Static Properties
- digitsOnly → WhitelistingTextInputFormatter
-
A WhitelistingTextInputFormatter that takes in digits
[0-9]
only.final