passes method
Validates the value using the given context.
Returns true if valid, otherwise false.
Implementation
@override
FutureOr<bool> passes(ValidationContext context) async {
final value = context.value;
// First check if it's a valid URL format
if (!await UrlRule().passes(context)) return false;
if (value is! String) return false;
try {
final uri = Uri.parse(value);
final host = uri.host;
if (host.isEmpty) return false;
final addresses = await InternetAddress.lookup(host);
return addresses.isNotEmpty && addresses[0].rawAddress.isNotEmpty;
} catch (e) {
return false;
}
}