Internet Permission ๐ŸŒ

A Flutter plugin that automatically adds internet permissions for all platforms!

One command โ€” all platforms configured! โšก

โœจ Features

  • ๐Ÿš€ Automatic setup โ€” Just run: dart run internet_permission:setup
  • ๐Ÿ“ฑ Supports 6 platforms โ€” Android, iOS, macOS, Windows, Linux, Web
  • ๐Ÿ”’ Safe โ€” Creates backup files before making changes
  • โšก Fast โ€” Setup completes in seconds
  • ๐ŸŽฏ Easy โ€” No additional configuration needed

๐Ÿš€ Quick Start

1๏ธโƒฃ Install

flutter pub add internet_permission

2๏ธโƒฃ Setup (Automatic!)

dart run internet_permission:setup

That's all! โœ…

๐Ÿ“‹ What Does It Add?

๐Ÿ“ฑ Android

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

๐ŸŽ iOS

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

๐Ÿ’ป macOS

<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>

๐ŸชŸ Windows

โœ… Default permission (no setup needed)

๐Ÿง Linux

โœ… Default permission (no setup needed)

๐ŸŒ Web

โœ… Default permission (no setup needed)

๐Ÿ’ป Usage

Check Internet Connection

InternetCheckedScaffold(
  appBar: AppBar(title: Text('My App')),
  body: Center(child: Text('Content')),
)e

Full Example

import 'package:flutter/material.dart';
import 'package:internet_connection_checker/internet_connection_checker.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Internet Checker Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        useMaterial3: true,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return InternetCheckedScaffold(
      appBar: AppBar(
        title: Text('Internet Checker Demo'),
        centerTitle: true,
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Icon(
              Icons.wifi,
              size: 100,
              color: Colors.green,
            ),
            SizedBox(height: 20),
            Text(
              'Internet is connected!',
              style: TextStyle(
                fontSize: 20,
                fontWeight: FontWeight.bold,
              ),
            ),
            SizedBox(height: 10),
            Text(
              'Try turning off your internet to see the dialog',
              textAlign: TextAlign.center,
              style: TextStyle(color: Colors.grey),
            ),
          ],
        ),
      ),
      // Custom settings
      dialogTitle: 'Connection Lost',
      dialogMessage: 'Unable to connect to the internet. Please check your connection.',
      retryButtonText: 'Try Again',
      checkInterval: Duration(seconds: 3),
    );
  }
}

๐Ÿ“ฑ Setup Script Output

$ dart run internet_permission:setup

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘  ๐Ÿš€ Internet Permission Setup v2.0.0                  โ•‘
โ•‘  ๐Ÿ“ฑ For all platforms                                 โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

๐Ÿ“ Project: /path/to/your/project

๐Ÿ”ง Configuring platforms...

๐Ÿ“ฑ Android: โœ… Added (INTERNET, ACCESS_NETWORK_STATE)
๐ŸŽ iOS: โœ… Added (NSAppTransportSecurity)
๐Ÿ’ป macOS: โœ… Added (network.client, network.server)
๐ŸชŸ Windows: โœ… Default permissions
๐Ÿง Linux: โœ… Default permissions
๐ŸŒ Web: โœ… Default permissions

โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
โœ… 6/6 platforms successfully configured!

๐Ÿ“‹ Next steps:
   1. flutter clean
   2. flutter pub get
   3. flutter run
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

๐ŸŽฏ API Reference

๐Ÿ“ฑ Android (manual)

Edit android/app/src/main/AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    
    <application>
        <!-- ... -->
    </application>
</manifest>

๐ŸŽ iOS (manual)

Edit ios/Runner/Info.plist:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

๐Ÿ’ป macOS (manual)

Edit macos/Runner/DebugProfile.entitlements and Release.entitlements:

<dict>
    <key>com.apple.security.network.client</key>
    <true/>
    <key>com.apple.security.network.server</key>
    <true/>
</dict>

๐Ÿงช Testing

In Example Project

cd example
dart run internet_permission:setup
flutter run

In a New Project

flutter create my_app
cd my_app
flutter pub add internet_permission
dart run internet_permission:setup
flutter run -d macos

โš ๏ธ Important Notes

  • Backup Files โ€” The script creates .backup files before making changes
  • Repeatable โ€” Safe to run multiple times; skips already configured platforms
  • Production โ€” For iOS/macOS, use HTTPS connections in production
  • Web โ€” CORS must be configured on your server
  • Backward Compatibility โ€” Old command setup_permissions still works

๐Ÿ› Troubleshooting

Script Not Working?

flutter clean
flutter pub get
dart run internet_permission:setup

Platform Missing?

Some platforms may not exist in your project by default โ€” this is normal.

Permissions Not Added?

If automatic setup fails, follow the manual setup instructions above.

๐Ÿ“ฆ Version History

2.0.2 โ€” 2025-12-06 ๐ŸŽ‰

  • โœจ NEW: Support for all 6 platforms
  • ๐Ÿš€ Simplified command: dart run internet_permission:setup
  • ๐ŸŽจ Improved terminal UI
  • โšก Faster execution

1.0.5 โ€” 2025-12-05

  • Automatic setup script
  • Android & iOS support

๐Ÿค Contributing

Pull requests are welcome! Feel free to contribute to this project.

๐Ÿ“„ License

MIT License

๐Ÿ‘จโ€๐Ÿ’ป Author

AbubakrFlutter


โญ If you find this plugin useful, please leave a star on GitHub!