validateWebsite static method
Ensures that a provided string is the same form as a valid URL
Implementation
static String? validateWebsite(String? value) {
if (value == null) {
return 'Value cannot be empty';
}
final regex = RegExp(
r'^(https?|ftp)://[^\s/$.?#].\S*$',
caseSensitive: false,
multiLine: false,
);
if (!regex.hasMatch(value)) {
return 'Value must be a valid website URL';
}
return null;
}