isSSN method

bool isSSN(
  1. String value
)

Check if the string is a valid SSN string.

Implementation

bool isSSN(String value) {
  final String ssn = value.replaceAll('-', '').replaceAll(' ', '');

  if (ssn.length != 9) {
    return false;
  }

  return regex == _ssn
      ? regex.hasMatch(value) || _ssnCleaned.hasMatch(ssn)
      : regex.hasMatch(value) || regex.hasMatch(ssn);
}