BlacklistingTextInputFormatter class
A TextInputFormatter that prevents the insertion of blacklisted characters patterns.
Instances of blacklisted characters found in the new TextEditingValues will be replaced with the replacementString which defaults to the empty string.
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:
- WhitelistingTextInputFormatter, which uses a whitelist instead of a blacklist.
- Inheritance
- Object
- TextInputFormatter
- BlacklistingTextInputFormatter
Constructors
- BlacklistingTextInputFormatter(Pattern blacklistedPattern, { String replacementString: '' })
- Creates a formatter that prevents the insertion of blacklisted characters patterns. [...]
Properties
- blacklistedPattern → Pattern
-
A Pattern to match and replace incoming TextEditingValues.
final
- replacementString → String
-
String used to replace found patterns.
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
- singleLineFormatter → BlacklistingTextInputFormatter
-
A BlacklistingTextInputFormatter that forces input to be a single line.
final