[cronet_http] Add DNS configuration options to CronetEngine.build (#1945) * [cronet_http] Add DNS configuration options to CronetEngine.build Expose Cronet DnsOptions through new CronetEngine.build parameters: useBuiltInDnsResolver, enableStaleDns, persistHostCache and persistHostCachePeriod. Cronet enables QUIC by default, and with QUIC enabled it resolves hosts through its built-in DNS resolver. On some cellular networks and in background isolates (e.g. WorkManager) that resolver fails with ERROR_HOSTNAME_NOT_RESOLVED while the system resolver works. useBuiltInDnsResolver: false forces the system resolver; enableStaleDns/persistHostCache allow a freshly created engine to serve recently used hosts from a persisted cache. setDnsOptions is available on the stable CronetEngine.Builder in both cronet-api artifacts the plugin ships (play-services and embedded), and the Java API layer transparently falls back to an experimental-options JSON patch on implementations that do not support DnsOptions natively, so no experimental bindings are required. Helps with https://github.com/dart-lang/http/issues/1217 * [cronet_http] Add fine-grained stale-DNS options to CronetEngine.build useStaleOnNameNotResolved, allowCrossNetworkUsage and maxStaleDnsExpiredDelay let a request fall back to an expired host cache entry instead of failing with ERROR_HOSTNAME_NOT_RESOLVED when a fresh DNS lookup fails -- independent of which resolver (built-in vs system) performed the lookup. * Update pkgs/cronet_http/lib/src/cronet_client.dart Co-authored-by: Brian Quinlan <bquinlan@google.com> * [cronet_http] Refine DnsOption documentation Updates the description for `enableStaleDns` for improved clarity and removes internal details about Cronet's experimental options fallback for `DnsOptions`. --------- Co-authored-by: Brian Quinlan <bquinlan@google.com>
A composable, Future-based library for making HTTP requests.
package:http contains a set of high-level functions and classes that make it easy to consume HTTP resources. It's multi-platform, and supports mobile, desktop, and the browser.
| Package | Description | Version |
|---|---|---|
| cronet_http | An Android Flutter plugin that provides access to the Cronet HTTP client. | |
| cupertino_http | A macOS/iOS Flutter plugin that provides access to the Foundation URL Loading System. | |
| flutter_http_example | An Flutter app that demonstrates how to configure and use package:http. | — |
| http | A composable, multi-platform, Future-based API for HTTP requests. | |
| http2 | A HTTP/2 implementation in Dart. | |
| http_client_conformance_tests | A library that tests whether implementations of package:http's Client class behave as expected. | |
| http_multi_server | A dart:io HttpServer wrapper that handles requests from multiple servers. | |
| http_parser | A platform-independent package for parsing and serializing HTTP formats. | |
| http_profile | A library used by HTTP client authors to integrate with the DevTools Network View. | |
| ok_http | An Android Flutter plugin that provides access to the OkHttp HTTP client and the OkHttp WebSocket API. | |
| web_socket | Any easy-to-use library for communicating with WebSockets that has multiple implementations. | |
| web_socket_channel | StreamChannel wrappers for WebSockets. Provides a cross-platform WebSocketChannel API. | |
| web_socket_conformance_tests | A library that tests whether implementations of package:web_socket's WebSocket class behave as expected. |
If you'd like to contribute to any of these packages, see the Contributing Guide.