network_checker_plus 1.0.6
network_checker_plus: ^1.0.6 copied to clipboard
A Flutter plugin to check network connectivity, type, and more.
π‘ network_checker_plus #
A lightweight and efficient Flutter plugin to check the network status of the device. Easily determine whether the user is connected to the internet and what type of network theyβre using β Wi-Fi, mobile data, or none. Now with support for network speed, signal strength, and real-time connectivity stream.
β¨ Features #
β Check if the device is connected to the internet
β Detect the type of connection (Wi-Fi, Mobile, or None)
β Estimate network speed (e.g., ping a server or download a small file)
β Measure signal strength (Wi-Fi)
β Real-time stream of connectivity status
π Getting Started #
1οΈβ£ Add Dependency #
Add this to your pubspec.yaml:
dependencies:
network_checker_plus: ^1.0.6
Then run:
flutter pub get
2οΈβ£ Import the Package #
import 'package:network_checker_plus/network_checker_plus.dart';
π Usage #
β Check Internet Status #
final bool isConnected = await NetworkCheckerPlus.isConnected();
print('Connected: \$isConnected');
π‘ Get Connection Type #
final String type = await NetworkCheckerPlus.getConnectionType();
print('Connection Type: \$type');
Possible values:
- 'wifi'
- 'mobile'
- 'none'
- 'unknown'
βοΈ Estimate Network Speed #
final String speed = await NetworkCheckerPlus.getNetworkSpeed();
print('Network Speed: \$speed');
Possible values:
- "Excellent"
- "Good"
- "Moderate"
- "Poor"
- "No Connection"
πΆ Get Signal Strength (Wi-Fi only) #
final int strength = await NetworkCheckerPlus.getSignalStrength();
print('Signal Strength: \$strength/4');
Signal levels range from 0 (Weak) to 4 (Excellent).
β³ Listen to Connectivity Changes #
NetworkCheckerPlus.connectivityStream.listen((event) {
print('Connectivity Changed: \$event');
});
Events:
- 'connected'
- 'disconnected'
π‘ Permissions #
π± Android #
Ensure you add the following permissions in android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
Some features (e.g., signal strength) may require ACCESS_FINE_LOCATION on newer Android versions.
π§ͺ Example #
Clone this repo and run the example app to see it in action:
cd example
flutter run
π‘ Roadmap #
- β Check network connection
- β Detect connection type (Wi-Fi or Mobile)
- β Estimate basic network speed
- β Measure Wi-Fi signal strength
- β Real-time listener for network changes
- β Support signal strength for mobile networks
π₯ Contributing #
We welcome contributions! Whether itβs bug reports, feature requests, documentation, or code β all are appreciated.
- Fork the repo
- Create your feature branch:
git checkout -b feature/my-feature - Commit your changes:
git commit -m 'Add some feature' - Push to the branch:
git push origin feature/my-feature - Open a pull request
π License #
This project is licensed under the MIT License - see the LICENSE file for details.
π¬ Support #
If you find this plugin helpful, please consider giving it a β on GitHub and sharing it with other Flutter developers!
Questions? Suggestions? Open an issue
Made with β€οΈ for Flutter developers.