mgs_connectivity_check 1.1.1 copy "mgs_connectivity_check: ^1.1.1" to clipboard
mgs_connectivity_check: ^1.1.1 copied to clipboard

A customizable Flutter connectivity checker with internet validation and automatic no-internet dialog support.

📦 mgs_connectivity_check

A Flutter connectivity utility that verifies real internet access and provides an optional customizable no-internet dialog with automatic monitoring.

Overview

mgs_connectivity_check helps Flutter applications:

Verify actual internet access (not just network type)

Listen to connectivity changes

Automatically show a configurable no-internet dialog

Open system network settings

Support Web and all major Flutter platforms

The package performs DNS-based validation (except on Web where platform limitations apply).

Features

Real internet connectivity verification

Connectivity change listener

Automatic no-internet dialog

Built-in Open Settings button

Fully customizable dialog UI

Optional full dialog override

Web-safe implementation

Abstracted connection type enum

Installation

Add the dependency to your pubspec.yaml:

dependencies: mgs_connectivity_check: ^1.1.0

Then run:

flutter pub get

Usage

Import the package:

import 'package:mgs_connectivity_check/mgs_connectivity_check.dart';

1️⃣ Check Internet Manually bool connected = await MgsConnectivityCheck.isConnectedToInternet();

2️⃣ Listen & Automatically Show Dialog @override void initState() { super.initState();

WidgetsBinding.instance.addPostFrameCallback((_) { MgsConnectivityCheck .listenChangeInInternetConnectivityWithDialog( context: context, ); }); }

@override void dispose() { MgsConnectivityCheck.dispose(); super.dispose(); }

3️⃣ Get Connection Type final types = await MgsConnectivityCheck.getConnectionTypes();

print(types);

Dialog Customization

You can customize the dialog using MgsDialogStyle:

MgsConnectivityCheck.listenChangeInInternetConnectivityWithDialog( context: context, dialogStyle: MgsDialogStyle( backgroundColor: Colors.black, buttonColor: Colors.blue, buttonText: "Retry", enableOpenSettingsButton: true, openSettingsButtonText: "Open Settings", ), );

Open System Settings

Enable system settings button:

MgsDialogStyle( enableOpenSettingsButton: true, );

If wireless settings are unavailable on a platform, the system default settings screen will open.

Full Dialog Override

You can completely replace the built-in UI:

MgsDialogStyle( customDialog: YourCustomWidget(), );

Platform Support Platform Supported Android Yes iOS Yes Web* Yes macOS Yes Windows Yes Linux Yes

  • Web uses limited browser connectivity APIs.

Important Notes

Network type does not guarantee internet access.

This package performs DNS validation (except on Web).

Always implement proper error handling for network requests.

License

MIT License

4
likes
0
points
447
downloads

Publisher

unverified uploader

Weekly Downloads

A customizable Flutter connectivity checker with internet validation and automatic no-internet dialog support.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

app_settings, connectivity_plus, flutter

More

Packages that depend on mgs_connectivity_check