isUrlValid function
Returns true if url is a well-formed http or https URL.
Implementation
bool isUrlValid(String url) {
return RegExp(
r'^((https?):\/\/)((www\.)?([a-zA-Z0-9!_$]+)\.([a-zA-Z]{2,5}))\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$',
).hasMatch(url);
}