generic static method
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,
);
}