validateCVC method
Checks whether or not the {@link #cvc} field is valid.
@return {@code true} if valid, {@code false} otherwise
Implementation
bool validateCVC() {
if (isBlank(cvc)) {
return false;
}
String cvcValue = cvc!.trim();
CardBrand? updatedType = brand;
bool validLength =
(updatedType == null && cvcValue.length >= 3 && cvcValue.length <= 4) ||
(CardBrand.amex == updatedType && cvcValue.length == 4) ||
cvcValue.length == 3;
return ModelUtils.isWholePositiveNumber(cvcValue) && validLength;
}