flutter_network_guard 0.1.2 copy "flutter_network_guard: ^0.1.2" to clipboard
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's message parameter, which didn't compile because it tried to forward to a positional super parameter as a named one.
  • Fixed NetworkGuard.initialize() awaiting NetworkService.dispose(), which returns void, not a Future.
  • Fixed a non-exhaustive switch in the connectivity adapter caused by newer connectivity_plus versions adding ConnectivityResult.satellite; it now falls back to ConnectivityType.other for any future values too.
  • Fixed NetworkQualityThresholds's ordering check, which used Duration's < operator inside a const constructor assert — not allowed in Dart's constant evaluation. The check now runs at classify() call time instead.

0.1.0 #

Initial release.

  • Connectivity detection (ConnectivityService, wrapping connectivity_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 NetworkGuard facade: 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.execute for protected calls: retry, deduplication, cancellation, timeout, and a typed NetworkResult (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:http client 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 dio as 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.
3
likes
130
points
146
downloads
screenshot

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Network reliability toolkit for Flutter — real internet reachability, server health checks, retry with backoff, offline queue, caching and network-aware widgets. State-management agnostic.

Repository (GitHub)
View/report issues
Contributing

Topics

#connectivity #network #retry #offline #cache

License

MIT (license)

Dependencies

connectivity_plus, dio, flutter, http, shared_preferences

More

Packages that depend on flutter_network_guard