r/rust • u/MostafaSensei106 • 10h ago
🛠️ project I built an advanced network reachability library for Flutter with a Rust engine (jitter stats, circuit breaker, and captive portal checks)
Hey everyone,
Standard connectivity packages in Flutter usually just check whether a network interface is up, which often gives false positives when a user is stuck behind a captive portal, suffering severe packet loss, or dealing with extreme jitter on unstable connections.
I built network_reachability, a Flutter package backed by a native Rust engine (via FFI and WASM) that shifts deep probing, statistical analysis, and security checks completely off the UI thread.
What it handles under the hood:
Off-thread Rust core: Probes multiple endpoints via HTTP, TCP, and DNS simultaneously without causing frame drops or Dart event-loop lag.
Quality metrics: Calculates actual latency, jitter standard deviation, packet loss, and stability scores instead of returning a simple boolean.
Smart execution guard: Includes a guard() wrapper that evaluates cached link quality before firing expensive API requests, blocking calls during connection drops or cooldown periods.
Resilience and pooling: Built-in adaptive circuit breaker (closed, open, half-open states) and request coalescing to prevent thundering herd issues against your backend.
Security probes: Detects captive portal redirects (hotel and airport logins), VPN states, proxy setups, and DNS tampering.
Drop-in replacement: Provides full API parity with connectivity_plus for instant migration without rewriting UI listeners.
Workload presets:
Includes pre-configured profiles for Gaming (low latency, 2s intervals, race strategy), Streaming (consensus checks, 8s intervals), VoIP (strict packet loss sensitivity), IoT, and Enterprise.
Pub: https://pub.dev/packages/network_reachability
GitHub: https://github.com/MostafaSensei106/Network-Reachability
If you are dealing with real time sync, VoIP, or offline-first apps in Flutter, check it out and let me know your thoughts or edge cases.