isUrl method
Validates if the given url
is a properly formatted URL.
Returns true
if the url
is valid, otherwise false
.
Implementation
bool isUrl(String url) {
try {
final uri = Uri.parse(url);
return uri.isAbsolute && (uri.scheme == 'http' || uri.scheme == 'https');
} catch (e) {
return false;
}
}