flutter_network_monitor 0.0.4
flutter_network_monitor: ^0.0.4 copied to clipboard
A Flutter package to monitor network speed, connection type, and video streaming quality.
π flutter_network_monitor #
flutter_network_monitor is a Flutter package that allows developers to monitor network speed, connection type, and internet quality in real-time. This package helps determine video streaming quality and classifies network speeds for an optimal user experience.
π Features #
β
Network Type Detection β Detects if the user is on WiFi, Mobile Data, or No Connection.
β
Real-Time Speed Monitoring β Measures download & upload speeds dynamically.
β
Video Quality Assessment β Suggests the best video quality based on network speed.
β
Connection Quality Classification β Categorizes speed into Poor, Moderate, Good, Excellent.
β
Live Connectivity Updates β Listens for network changes in real-time.
πΊ Installation #
Add the following dependency to your pubspec.yaml:
dependencies:
flutter_network_monitor: ^0.0.1
Then, run:
flutter pub get
π§ Usage #
1οΈβ£ Import the Package #
import 'package:flutter_network_monitor/flutter_network_monitor.dart';
2οΈβ£ Monitor Network Type (WiFi/Mobile/etc.) #
final connectionMonitor = ConnectionTypeMonitor();
connectionMonitor.onConnectivityChanged.listen((networkType) {
print('Network Type: $networkType');
});
3οΈβ£ Measure Download Speed #
final speedTest = SpeedTest();
void checkDownloadSpeed() async {
double speed = await speedTest.testDownloadSpeed();
print('Download Speed: \${speed.toStringAsFixed(2)} Mbps');
}
4οΈβ£ Determine Video Streaming Quality #
double internetSpeed = 6.0; // Example speed in Mbps
VideoQuality quality = VideoQualityDeterminer.determineQuality(internetSpeed);
print('Recommended Video Quality: \${VideoQualityDeterminer.getQualityString(quality)}');
5οΈβ£ Get Connection Quality (Poor/Good/Excellent) #
double speed = 4.5; // Example speed in Mbps
ConnectionQuality quality = ConnectionQualityDeterminer.determineQuality(speed);
print('Connection Quality: \${ConnectionQualityDeterminer.getQualityString(quality)}');
π License #
This package is licensed under the MIT License.
π© Contributions & Issues #
π‘ Contributions are welcome! If you find a bug or have a feature request, feel free to open an issue.
π Like this package? #
Give it a β on pub.flutter-io.cn and GitHub! π