Skip to main content

netguard 2.0.0 copy "netguard: ^2.0.0" to clipboard
netguard: ^2.0.0 copied to clipboard

A Dio-based HTTP client for Flutter with caching, connectivity handling, auth token refresh, retries and certificate pinning.

2.0.0 - 2026-08-31 #

💥 Breaking #

  • Non-2xx responses throw again. 1.x forced validateStatus: (s) => s < 600, so try/catch never fired. Opt out with options.resolveErrorStatuses = true.
  • Offline requests throw NetworkOfflineException instead of returning a fabricated 503 body. Choose OfflineBehavior.fail / .wait / .queue.
  • response.isRedirect → isRedirection. Dio's Response declares its own isRedirect field, which shadowed the 1.x extension getter.
  • IOHttpClientAdapter moved to package:netguard/io.dart, keeping the main entry point web-safe.

⚠️ Deprecated (still work, removed in 3.0.0) #

Deprecated Use instead
encryptionFunction bodyEncoder
encryptBody: encodeBody:
useCache: true cachePolicy: CachePolicy.staleWhileRevalidate
throwOnOffline = true offlineBehavior = OfflineBehavior.fail
throwOnOffline = false offlineBehavior = OfflineBehavior.wait
autoRetryOnNetworkRestore = true offlineBehavior = OfflineBehavior.queue
maxNetworkRetries = n retryPolicy = RetryPolicy(maxAttempts: n)
networkRetryDelay = d retryPolicy = RetryPolicy(initialDelay: d)
showLogs = true logLevel = NetGuardLogLevel.verbose
showLogs = false logLevel = NetGuardLogLevel.error

bodyEncoder was renamed because the default is base64 encoding, not encryption — it provides no confidentiality.

🐞 Fixed #

  • configureAuth() doubled the interceptor chain on every call (1 → 3 → 5 → 9).
  • options.configureAuth(...) silently did nothing — the client and its options each built a separate AuthManager.
  • handleNetwork = true was a no-op on every client not built with fromDio.
  • Typed requests threw _TypeError while offline.
  • The auth queue always threw — it cast between two sibling handler types.
  • Every cache miss issued two identical requests.
  • Cache keys omitted base URL and method, and depended on query ordering.
  • Web clients reported themselves permanently offline.
  • The cache selected the dart:io store under wasm.
  • token.substring(0, 20) threw RangeError on short tokens, and leaked credentials into logs.
  • AuthInterceptor.clear() threw StateError after a settled refresh.
  • Queued requests produced unhandled async errors.
  • NetworkService.dispose() left a permanently dead singleton.
  • getUri discarded the URI's own query parameters.
  • Cache, connectivity and auth errors were logged at a level that never printed.
  • Auth replays went through a throwaway Dio(), skipping your interceptors.

✨ Added #

  • Cache policies (cacheFirst, networkFirst, staleWhileRevalidate, cacheOnly), ETag/304 revalidation, and pattern invalidation.
  • RetryPolicy — exponential backoff, jitter, Retry-After, idempotent-only.
  • Request deduplication for identical in-flight GETs.
  • Persistent offline queue with idempotency keys, surviving restarts.
  • Proactive token refresh from the JWT exp claim.
  • Certificate pinning via pinCertificates(...).
  • NetGuardLogger with levels, a pluggable sink and credential redaction; enableLogging(emitCurl: true).
  • Typed decoding with getAs/postAs, plus apiError / apiMessage.
  • Cancellation groups, rate limiting, and per-request metrics.

🔧 Changed #

  • All verbs share one request pipeline, so caching, connectivity, retry, deduplication and metrics behave identically everywhere.
  • Connectivity no longer pings google.com, cloudflare.com and httpbin.org on every network change. Configure a probe against your own endpoint instead.
  • dio 5.11. Test suite rewritten against a mock adapter (53 tests).

1.0.4 - 2026-02-04 #

🔧 Maintenance & Bug Fixes #

  • Fixed all "token log issu warnings and hints across the library.

1.0.3 - 2026-01-12 #

🔧 Maintenance & Bug Fixes #

  • Fixed all dart analyze warnings and hints across the library and examples.
  • Standardized LICENSE file to standard MIT format for better package recognition on pub.dev.

1.0.2 - 2026-01-12 #

🔧 Maintenance #

  • Updated connectivity_plus to ^7.0.0 to support the latest stable version and satisfy package analysis requirements.

1.0.1 - 2026-01-06 #

✨ New Features #

  • Added isLogin parameter to request methods.
    • Prevents automatic token refresh loops on 401 errors during login.
    • Bypasses offline queueing for login requests.
  • Added showLogs option to NetGuardOptions.
    • Allows toggling verbose logging on/off.
    • Critical errors are still shown even if logs are disabled.

1.0.0 - 2025-08-08 #

🎉 Initial Release #

Core Features #

  • All HTTP methods (GET, POST, PUT, PATCH, DELETE)
  • File upload/download with progress tracking
  • Static instance management and custom configurations
  • Interceptor support for request/response manipulation
  • Real-time network status updates via streams
2
likes
160
points
21
downloads

Documentation

API reference

Publisher

verified publisherniteshmandal1.com.np

Weekly Downloads

A Dio-based HTTP client for Flutter with caching, connectivity handling, auth token refresh, retries and certificate pinning.

Repository (GitHub)
View/report issues
Contributing

Topics

#http #networking #dio #cache #authentication

License

MIT (license)

Dependencies

connectivity_plus, crypto, dio, flutter, hive, path_provider

More

Packages that depend on netguard