isValidUrl method
check string is valid url
Implementation
bool isValidUrl([List<String?> protocols = const ['http', 'https', 'ftp']]) {
var str = this;
if (str == null || str.isEmpty) return false;
var schemes = protocols.join('|');
String pattern = r'(' +
schemes +
r')://[\w-]+(\.[\w-]+)+([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?';
RegExp regExp = RegExp(pattern);
return regExp.hasMatch(str);
}