net_checker 0.0.6 copy "net_checker: ^0.0.6" to clipboard
net_checker: ^0.0.6 copied to clipboard

A lightweight Flutter package to check internet connectivity, monitor connection changes, measure latency, and detect network quality.

net_checker #

pub version likes license

A lightweight and cross-platform Flutter package to check internet connectivity, monitor connection changes, measure latency, detect network quality, and identify working hosts.


Quick Example #

final connected = await InternetChecker.hasConnection();

if (connected) {
  print("Connected");
} else {
  print("No Internet");
}

Features #

Feature Supported
Internet connectivity check
Real-time connection monitoring
Network latency measurement
Network quality detection
Working host detection
Custom host configuration
UI widgets for connectivity status
Cross-platform support

Platform Support #

Platform Supported Notes
Android Requires INTERNET permission
iOS No extra permission required
Web Limited by browser security (CORS)
Windows No extra setup
macOS No extra setup
Linux No extra setup

Why net_checker? #

Unlike basic connectivity packages, net_checker provides:

  • Real internet access check (not just network type)
  • Built-in latency measurement
  • Network quality detection (Good / Poor / etc.)
  • Working host detection
  • Ready-to-use UI widgets

All in one lightweight package.


Installation #

dependencies:
  net_checker: ^latest
flutter pub get

Import #

import 'package:net_checker/net_checker.dart';

Check Internet Connection #

bool connected = await InternetChecker.hasConnection();

Get Working Host #

String? host = await InternetChecker.getWorkingHost();

Network Latency #

int? latency = await LatencyChecker.getLatency();

Network Quality #

String quality = await NetworkQuality.getQuality();

Listen to Connection Changes #

InternetConnectionStream.start().listen((status) {
  print(status);
});

Custom Configuration #

final config = InternetConfig(
  hosts: ["google.com", "cloudflare.com", "1.1.1.1"],
  timeout: Duration(seconds: 3),
  checkInterval: Duration(seconds: 5),
);

Usage with config #

await InternetChecker.hasConnection(config: config);
await LatencyChecker.getLatency(config: config);
await NetworkQuality.getQuality(config: config);
await InternetChecker.getWorkingHost(config: config);

Widgets #

Internet Status Indicator #

InternetStatusIndicator()

Internet Status Builder #

InternetStatusBuilder(
  builder: (context, status) {
    return Text(status.toString());
  },
)

No Internet Banner #

NoInternetBanner(visible: true)

Use Cases #

  • Show offline banner in apps
  • Retry API calls automatically
  • Monitor connection quality
  • Detect slow networks

Platform Configuration #

Android #

Add permission in android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET"/>

iOS #

No additional permission required.

If using network calls extensively, ensure App Transport Security allows your endpoints if needed:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>

Web #

  • Uses browser-based network detection
  • Subject to CORS and browser security restrictions
  • Connectivity checks may not fully match mobile/desktop behavior
  • Host verification and latency may be limited

Desktop (Windows / macOS / Linux) #

No additional configuration required.


Best Practices #

  • Use default configuration unless needed
  • Avoid very low checkInterval (e.g. < 2 seconds) as it may increase network usage
  • Use multiple hosts for reliability

Author #

Developed and maintained by Lionheartapps
https://www.lionheartapps.com


Support the Project #

If you find net_checker useful, you can support its development.

Buy Me A Coffee

License #

MIT License

Screenshots #

Connected Disconnected

1
likes
140
points
13
downloads

Documentation

API reference

Publisher

verified publisherlionheartapps.com

Weekly Downloads

A lightweight Flutter package to check internet connectivity, monitor connection changes, measure latency, and detect network quality.

Homepage
Repository (GitHub)
View/report issues

Topics

#connectivity #internet #network #flutter

License

MIT (license)

Dependencies

flutter, http, web

More

Packages that depend on net_checker