panValidate method

bool panValidate({
  1. required String content,
})

This Method will validate your content from PAN Number Format. content Content is a Required parameter. Pass your inputed or that value which you want to compare with PAN number format.

Implementation

bool panValidate({required String content}) {
    // First of all it will check length of the Content.
    if (content.length != 10) {
      return false;
    } else {
      // Here Comparing Content from PAN Format.
      return RegExp(r"^[A-Z]{5}[0-9]{4}[A-Z]{1}").hasMatch(content);
    }
  }