🌌 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! πŸŽ‰