url static method

String? url(
  1. String? value
)

Validate URL

Implementation

static String? url(String? value) {
  if (value == null || value.isEmpty) {
    return null; // URL is optional in most cases
  }

  if (!RegexPatterns.url.hasMatch(value)) {
    return 'Please enter a valid URL';
  }

  return null;
}