InputValidation.phone constructor

InputValidation.phone({
  1. String? errorMsg,
  2. String? emptyTip,
  3. bool mustFill = true,
})

手机号校验(中国大陆)/ Chinese phone number validation

Example:

validator: InputValidation.phone(errorMsg: "请输入正确的手机号").validate

Implementation

factory InputValidation.phone({
  String? errorMsg,
  String? emptyTip,
  bool mustFill = true,
}) {
  return InputValidation(
    mustFill: mustFill,
    regExp: RegExp(r'^1[3-9]\d{9}$'),
    errorMsg: errorMsg ?? "请输入正确的手机号",
    emptyTip: emptyTip ?? "手机号不能为空",
  );
}