I want to validate my ssn using FilteringTextInputFormatter.allow(RegExp()),
I want it to start with 1 or 2 with 10 length and last 9th numbers any number ,only first one should be 1 or 2
CodePudding user response:
TextFormField(
inputFormatters: [
LengthLimitingTextInputFormatter(10),
FilteringTextInputFormatter.allow(RegExp(r'^[12][0-9]*$')),
],
decoration: InputDecoration(
border: InputBorder.none,
labelText: 'PAN Number',
),
)