flutter_network_guard 0.1.2
flutter_network_guard: ^0.1.2 copied to clipboard
Network reliability toolkit for Flutter — real internet reachability, server health checks, retry with backoff, offline queue, caching and network-aware widgets. State-management agnostic.
Changelog #
0.1.1 #
Bugfixes found while compiling on a real Flutter/Windows setup:
- Fixed
RetryExhaustedException'smessageparameter, which didn't compile because it tried to forward to a positional super parameter as a named one. - Fixed
NetworkGuard.initialize()awaitingNetworkService.dispose(), which returnsvoid, not aFuture. - Fixed a non-exhaustive switch in the connectivity adapter caused by newer
connectivity_plusversions addingConnectivityResult.satellite; it now falls back toConnectivityType.otherfor any future values too. - Fixed
NetworkQualityThresholds's ordering check, which usedDuration's<operator inside aconstconstructor assert — not allowed in Dart's constant evaluation. The check now runs atclassify()call time instead.
0.1.0 #
Initial release.
- Connectivity detection (
ConnectivityService, wrappingconnectivity_plus). - Real Internet reachability with multi-endpoint fallback (
InternetChecker). - Server health checks and periodic monitoring, independent of Internet
reachability (
ServerHealthChecker,ServerHealthMonitor). - Latency-based network quality estimation (
NetworkQuality). - Unified
NetworkGuardfacade:initialize,instance,networkStream,checkInternet,checkServer, recovery callbacks, app-lifecycle awareness, debounced checks, and event history. - Retry engine with fixed/linear/exponential backoff, jitter, and smart
default retry rules (
RetryPolicy,RetryEngine). NetworkGuard.executefor protected calls: retry, deduplication, cancellation, timeout, and a typedNetworkResult(success / failure / offline / timeout / cancelled / queued).- Request deduplication (
RequestDeduplicator), cooperative cancellation (CancelToken), and stale-response protection (RequestManager). - Offline queue with priorities and optional persistence
(
OfflineQueue,QueuedRequest,SharedPreferencesQueueStorage). - Opt-in cache with TTL and five cache policies, including
stale-while-revalidate (
CacheManager,CachePolicy). - Network-aware widgets:
NetworkAware,NetworkStatusBanner,OfflineBanner,NetworkGuardBuilder,NetworkGuardButton,NetworkDebugPanel. - Logging (
NetworkLogger, off by default) and metrics (NetworkMetrics). - Optional Dio interceptor and
package:httpclient adapter — neither HTTP client is required to use the core package. - Example app demonstrating every module.
0.1.2 #
- Added screenshots and demo GIF to pub.dev listing.
- Fixed README image links (raw GitHub URLs).
Known limitations #
- The Dio adapter adds
dioas a package dependency even for apps that don't use it; a future release may split it into a companion package (see Roadmap in the README) to make it a true zero-cost opt-in. - Network quality is a latency-based estimate only, not a bandwidth measurement.
- Successful offline queueing does not guarantee eventual server delivery.
