isURL function

bool isURL(
  1. String str
)

Checks if the string is a valid HTTP or HTTPS URL.

The URL must have a non-empty host. The host must be localhost, an IP address, or a name that contains a dot (a TLD).

Example:

isURL('https://google.com'); // true
isURL('http://localhost'); // true
isURL('https://'); // false
isURL('http://foo'); // false
isURL('invalid-url'); // false

Implementation

bool isURL(String str) => _isURL(str);