url static method

String? url(
  1. String? value, {
  2. String errorMsg = 'Enter a valid URL',
})

🌎Url Validator

Implementation

static String? url(String? value, {String errorMsg = 'Enter a valid URL'}) {
  if (value == null || value.trim().isEmpty) return 'URL is required';
  return Uri.tryParse(value)?.hasAbsolutePath == true ? null : errorMsg;
}