For example, if expMonth is 01 and expYear is 12, and since expMonth is an int, the resulting String passed to _ccValidator.validateExpDate would be "1/12" instead of "01/12", which fails while matching with RegExp(r'((0[1-9])|(1[0-2]))(/)+(\d{2,4})')
Replacing the line
return _ccValidator.validateExpDate('$expMonth/$expYear').isValid;
with the following should fix:
return _ccValidator.validateExpDate('${expMonth.toString().padLeft(2, '0')}/${expYear.toString().padLeft(2, '0')}').isValid;
This is due to a bug in the following code:
bool validateDate() { return _ccValidator.validateExpDate('$expMonth/$expYear').isValid; }
For example, if expMonth is 01 and expYear is 12, and since expMonth is an int, the resulting String passed to _ccValidator.validateExpDate would be "1/12" instead of "01/12", which fails while matching with RegExp(r'((0[1-9])|(1[0-2]))(/)+(\d{2,4})')
Replacing the line
return _ccValidator.validateExpDate('$expMonth/$expYear').isValid;
with the following should fix:
return _ccValidator.validateExpDate('${expMonth.toString().padLeft(2, '0')}/${expYear.toString().padLeft(2, '0')}').isValid;