isFQDN function

bool isFQDN(
  1. String str
)

Checks if the string is a fully qualified domain name (FQDN).

Requires at least two labels separated by dots, a valid top-level domain, and labels that do not start or end with a hyphen.

Example:

isFQDN('example.com'); // true
isFQDN('sub.example.co.uk'); // true
isFQDN('localhost'); // false (no TLD)
isFQDN('-bad.com'); // false

Implementation

bool isFQDN(String str) => _isFQDN(str);