dns_client
1.3.1, released 10 months ago by amond.dev
Dart DNS-over-HTTPS (DoH) client supporting multiple providers and record types
What it does
Provides a Dart implementation of DNS-over-HTTPS (DoH) supporting Google, Cloudflare, AdGuard, NextDNS, Quad9, and OpenDNS. It resolves hostnames to IP addresses, supports 36 DNS record types, and includes wire format and privacy protection features.
AI-written summary of version 1.3.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to perform DNS lookups via HTTPS in a Dart or Flutter application
- You want to use specific DNS providers like Cloudflare, Google, AdGuard, or Quad9
- You need to query specific DNS record types such as MX, TXT, SRV, or HTTPS
Skip it when
- You rely entirely on the platform's standard built-in DNS resolution without custom DoH requirements
Strengths
- Supports multiple popular DoH providers
- Comprehensive coverage of 36 DNS record types
- Wire format support with HTTP/2
- Includes privacy features and error handling
Weaknesses
- Requires Dart SDK 3.7.0 or later
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- Yes (build_runner)
- Direct dependencies
- 5
not documented
import 'package:dns_client/dns_client.dart';
void main() async {
final dns = DnsOverHttps.google();
final addresses = await dns.lookup('google.com');
for (final address in addresses) {
print(address.address);
}
dns.close();
}Alternatives
Packages that do the same job and could replace dns_client.
- cronet_http
An Android Flutter plugin providing access to the Cronet HTTP client.
87Compare - sync_http
Synchronous HTTP client for Dart using RawSynchronousSockets.
50Compare - talker_http_logger
Lightweight and customizable HTTP client logger based on Talker for Dart and Flutter.
81Compare - centrifuge
Dart client for real‑time communication with Centrifuge/Centrifugo over WebSockets.
80Compare
Works with
Packages commonly used together with dns_client: ones it builds on, ones built on it, and its own family.
- json_annotationdns_client depends on itProvides annotations for json_serializable to generate JSON (de)serialization code.
- equatabledns_client depends on itProvides value‑based equality for Dart objects without manual == and hashCode.
- freezed_annotationdns_client depends on itAnnotations for the freezed code-generator.
- http2dns_client depends on itAn HTTP/2 implementation in Dart for low-level transport and pooled HTTP/2 requests.