generic static method

TextInputFormatter generic({
  1. required List<String> masks,
  2. Hashtag hashtag = Hashtag.numbers,
})

use to format date fields

TextFormField(
  autovalidateMode: AutovalidateMode.onUserInteraction,
  inputFormatters: [
    Mask.generic(
      masks: ['##-#', '###-#'] // use your custom masks
      hashtag: Hashtag.numbers, // optional field
    ),
  ],
),

Implementation

static TextInputFormatter generic({
  required List<String> masks,
  Hashtag hashtag = Hashtag.numbers,
}) {
  return GenericMask(
    mask: masks,
    hashtag: hashtag,
  );
}