filterPattern property

Pattern filterPattern
final

A Pattern to match or replace in incoming TextEditingValues.

The behavior of the pattern depends on the allow property. If it is true, then this is an allow list, specifying a pattern that characters must match to be accepted. Otherwise, it is a deny list, specifying a pattern that characters must not match to be accepted.

Typically the pattern is a regular expression, as in:
link
FilteringTextInputFormatter onlyDigits = FilteringTextInputFormatter.allow(RegExp(r'[0-9]'));

If the pattern is a single character, a pattern consisting of a String can be used:
link
FilteringTextInputFormatter noTabs = FilteringTextInputFormatter.deny('\t');

Implementation

final Pattern filterPattern;