ValidateDomainNameAllowNull static method

void ValidateDomainNameAllowNull(
  1. String? domainName,
  2. String paramName
)
Validates domain name (null value allowed) Domain name. Parameter name.

Implementation

static void ValidateDomainNameAllowNull(
    String? domainName, String paramName) {
  if (domainName != null) {
    RegExp regex = new RegExp(DomainRegex);

    if (!regex.hasMatch(domainName)) {
      throw new ArgumentException(
          "InvalidDomainName($domainName, $paramName)");
    }
  }
}