url static method
Validates whether the given url
is a valid URL.
The url
parameter should be a string representing a URL.
Returns true
if the url
is valid, false
otherwise.
Implementation
static bool url(String url) {
String pattern = r'^(http|https):\/\/([\w.]+)+(:[0-9]{1,5})?(\/.*)?$';
RegExp regExp = RegExp(pattern);
return regExp.hasMatch(url);
}