🌐 internet_health_plus

Advanced Internet Connectivity, Latency & Network Quality Detection for Flutter.


πŸ“Έ Example App Preview


πŸ“ Description

internet_health_plus is a production-ready Flutter plugin designed to provide real internet reachability, latency measurement, and network quality detection β€” far beyond what connectivity_plus offers.

It helps apps react to:

  • Slow networks
  • Sudden latency spikes
  • Dropped internet
  • Captive portals
  • Poor connections disguised as Wi-Fi/Mobile

All with battery-optimized active probing.


πŸ“‘ Issue with connectivity_plus?

Most apps use connectivity_plus to check Internet status, but it has an important limitation:

❌ connectivity_plus only tells you:

  • Whether the device is on Wi-Fi, Mobile, Ethernet, or Offline

  • NOT whether the internet actually works

  • Why this is not enough:

  • A device can be connected to Wi-Fi but still have:

  • No internet access

  • Slow or unstable internet

  • Captive portals (airport/hotel login pages)

  • High latency causing slow performance

  • Partial connectivity

In all these cases, connectivity_plus still reports wifi or mobile, even when the internet is unusable.

❀️ Why Choose internet_health_plus?

⭐ Real Internet Health

It checks actual connectivity (HTTP + socket fallback), not just WiFi/mobile status.

⭐ Detect Slow/Moderate/Good Networks

Based on real latency measurements.

⭐ Real-Time Stream Updates

Receive events instantly via:

Stream<InternetStatus>

⭐ Battery Efficient

  • Debouncing
  • Rate limiting
  • Shared Dio instance
  • Retry with exponential backoff

⭐ Works Everywhere

  • Android
  • iOS
  • Desktop
  • Flutter Web

⭐ Riverpod Ready

Built for reactive state management.


✨ Features

  • βœ” Real-time internet reachability
  • βœ” Latency measurement (ms)
  • βœ” Network quality classification
  • βœ” Connectivity Plus integration
  • βœ” Socket fallback
  • βœ” Retry logic with backoff
  • βœ” Custom thresholds
  • βœ” Highly configurable
  • βœ” Production tested

πŸš€ Installation

dependencies:
  internet_health_plus: ^1.0.0

πŸ“¦ Import

import 'package:internet_health_plus/internet_health_plus.dart';

🎯 Quick Usage

final checker = InternetHealthPlus();

checker.onStatusChange.listen((status) {
  print('Network: ${status.networkType}');
  print('Reachable: ${status.internetAvailable}');
  print('Latency: ${status.latencyMs}');
  print('Quality: ${status.quality}');
});

&

checker.hasInternetAccess();

πŸ”₯ Manual Refresh

final result = await checker.checkInternetDetailed();
print(result.quality);

🐒 Handling Slow Internet Connections

internet_health_plus doesn’t just tell you if you’re online β€” it also tells you when the connection is slow, so you can:

  • switch to low-data mode
  • load thumbnails instead of full-res images
  • delay heavy syncs or uploads
  • reduce polling frequency

You get two useful signals:

- status.quality β†’ good | moderate | slow | unknown
- status.isSlow β†’ true when quality is slow

🧩 Riverpod Integration

final internetCheckerProvider = Provider<InternetHealthPlus>((ref) {
  final checker = InternetHealthPlus();
  ref.onDispose(() => checker.dispose());
  return checker;
});

final internetStatusStreamProvider = StreamProvider<InternetStatus>((ref) {
  final checker = ref.watch(internetCheckerProvider);

  final controller = StreamController<InternetStatus>();
  controller.add(checker.lastStatus);

  final sub = checker.onStatusChange.listen(controller.add);

  checker.checkInternetDetailed(); // initial probe

  ref.onDispose(() {
    sub.cancel();
    controller.close();
  });

  return controller.stream;
});

πŸ§ͺ Testing Slow Internet

βœ” Android Emulator β†’ Edge / GPRS

βœ” Router throttling

βœ” Override thresholds:

ProbeOptions(latencyThresholds: {'good': 5, 'moderate': 10});

🧠 Architecture

 +-------------------------------+
 |      InternetHealthPlus       |
 |-------------------------------|
 | Connectivity listener         |
 | HTTP probe (Dio)              |
 | Socket fallback               |
 | Latency measurement           |
 | Debounce + rate-limit         |
 | Retry with backoff            |
 | Emits InternetStatus          |
 +-------------------------------+
                 |
                 v
      +-----------------------+
      |    InternetStatus     |
      +-----------------------+
      | networkType           |
      | internetAvailable     |
      | latencyMs             |
      | quality               |
      +-----------------------+

πŸ“„ License

MIT Β© SakshamSharma2026