FilteringTextInputFormatter class Null safety

A TextInputFormatter that prevents the insertion of characters matching (or not matching) a particular pattern.

Instances of filtered 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.

Inheritance
Implementers

Constructors

FilteringTextInputFormatter(Pattern filterPattern, {required bool allow, String replacementString: ''})
Creates a formatter that prevents the insertion of characters based on a filter pattern. [...]
FilteringTextInputFormatter.allow(Pattern filterPattern, {String replacementString: ''})
Creates a formatter that only allows characters matching a pattern. [...]
FilteringTextInputFormatter.deny(Pattern filterPattern, {String replacementString: ''})
Creates a formatter that blocks characters matching a pattern. [...]

Properties

allow bool
Whether the pattern is an allow list or not. [...]
final
filterPattern Pattern
A Pattern to match and replace in incoming TextEditingValues. [...]
final
hashCode int
The hash code for this object. [...]
read-only, inherited
replacementString String
String used to replace banned patterns. [...]
final
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 ==(Object other) bool
The equality operator. [...]
inherited

Static Properties

digitsOnly TextInputFormatter
A TextInputFormatter that takes in digits [0-9] only.
final
singleLineFormatter TextInputFormatter
A TextInputFormatter that forces input to be a single line.
final