MaskedInputFormatter constructor

MaskedInputFormatter(
  1. String mask, {
  2. RegExp? allowedCharMatcher,
})

mask is a string that must contain # (hash) and 0 (zero) as maskable characters. # means any possible character, 0 means only digits. So if you want to match e.g. a string like this GGG-FB-897-R5 you need a mask like this ###-##-000-#0 a mask like ###-### will also match 123-034 but a mask like 000-000 will only match digits and won't allow a string like Gtt-RBB

will match literally any character unless you supply an allowedCharMatcher parameter with a RegExp to constrain its values. e.g. RegExp(r'a-z+') will make # match only lowercase latin characters and everything else will be ignored

Implementation

MaskedInputFormatter(
  this.mask, {
  this.allowedCharMatcher,
});