isValid method
function to check if the provided gst is valid or not.
returns true if the dlNumber seems to be valid.
Implementation
bool isValid(String? gst) {
if (gst == null) return false;
if (gst.length != 15) {
// gst number must be 15 characters long
return false;
}
RegExp gstRegEx = RegExp(
r"^[0-9]{2}[A-Za-z]{5}[0-9]{4}[A-Za-z]{1}[1-9A-Za-z]{1}(Z|z)[0-9A-Za-z]{1}$");
if (gstRegEx.hasMatch(gst)) {
// now validate the checksum digit
return _validCheckSum(gst);
}
return false;
}