mgs_connectivity_check 1.0.0
mgs_connectivity_check: ^1.0.0 copied to clipboard
A customizable Flutter connectivity checker with internet validation and automatic no-internet dialog support.
mgs_connectivity_check #
A customizable Flutter connectivity checker with real internet validation and automatic no-internet dialog support.
✨ Features #
- ✅ Check real internet access (not just network type)
- ✅ Listen to connectivity changes
- ✅ Automatic customizable no-internet dialog
- ✅ Web-safe support
- ✅ Abstracted connection type enum
- ✅ Simple and easy integration
📦 Installation #
Add this to your pubspec.yaml:
dependencies:
mgs_connectivity_check: ^1.0.0
Then run:
flutter pub get
🚀 Usage #
Import the package:
import 'package:mgs_connectivity_check/mgs_connectivity_check.dart';
✅ Check Internet Connection #
bool isConnected =
await MgsConnectivityCheck.isConnectedToInternet();
✅ Listen & Show Automatic Dialog #
@override
void initState() {
super.initState();
MgsConnectivityCheck.listenChangeInInternetConnectivityWithDialog(
context: context,
title: "No Internet",
message: "Please check your connection.",
);
}
@override
void dispose() {
MgsConnectivityCheck.dispose();
super.dispose();
}
✅ Get Connection Type #
final types =
await MgsConnectivityCheck.getConnectionTypes();
print(types);
🎨 Customization #
You can customize:
- Dialog title
- Message
- Button color
- Background color
- Icon color
- Text styles
- Barrier dismiss behavior
🌐 Platform Support #
| Platform | Supported |
|---|---|
| Android | ✅ |
| iOS | ✅ |
| Web | ✅ |
| macOS | ✅ |
| Windows | ✅ |
| Linux | ✅ |
⚠️ Important Note #
Network type availability does NOT guarantee internet access.
This package performs real DNS lookup verification (except on Web where limitations apply).
📄 License #
MIT License