mobileValidate method

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

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

Implementation

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