cpfOrCnpj static method

TextInputFormatter cpfOrCnpj()

use to format cpfOrCnpj fields

TextFormField(
  autovalidateMode: AutovalidateMode.onUserInteraction,
  inputFormatters: [Mask.cpfOrCnpj()],
),

Implementation

static TextInputFormatter cpfOrCnpj() {
  return GenericMask(mask: ['###.###.###-##', '##.###.###/####-##']);
}