A Flutter plugin for VPN detection, internet connectivity checks, package information retrieval, device identification, emulator detection, and content sharing.
- VPN Status Checker: Detect VPN connection.
- Internet Connectivity Checker: Check Wi-Fi/Mobile Data connection.
- Package Information: Retrieve app metadata.
- Device ID: Fetch unique Android ID.
- Emulator Detection: Determine if the app is running on an emulator.
- Share Content: Share content to all or specific apps.
Add the plugin to your pubspec.yaml
file:
flutter_essential:
git:
url: https://github.com/Apex-Eagle-Solution-LLC/flutter_essential.git
Run flutter pub get
to fetch the package.
Detect if a VPN connection is active:
bool isVpnConnected = await FlutterEssential.isVpnConnected();
print('VPN Connected: \$isVpnConnected');
Check if the device is connected to the internet (Wi-Fi or Mobile Data):
bool isInternetConnected = await FlutterEssential.isInternetConnected();
print('Internet Connected: \$isInternetConnected');
Retrieve app metadata, such as the app name, package name, version, and build number:
PackageInfo? info = await FlutterEssential.getPackageInfo();
print('App Name: \${info?.appName}');
print('Package Name: \${info?.packageName}');
print('Version: \${info?.version}');
print('Build Number: \${info?.buildNumber}');
Fetch the unique Android device ID:
String? deviceId = await FlutterEssential.getDeviceId();
print('Device ID: \$deviceId');
Determine if the app is running on an emulator:
bool isEmulator = await FlutterEssential.isEmulator();
print('Running on Emulator: \$isEmulator');
Open the "Share to All Apps" dialog to share content with any app:
await FlutterEssential.shareToAllApps(content: "Check out this amazing plugin!");
Share content to a specific app, such as WhatsApp or Telegram:
await FlutterEssential.shareToSpecificApp(
content: "Hello from Flutter Essential!",
app: SharingApp.whatsapp, // Replace with SharingApp.telegram for Telegram
);
import 'package:flutter_essential/flutter_essential.dart';
void main() async {
bool vpn = await FlutterEssential.isVpnConnected();
bool internet = await FlutterEssential.isInternetConnected();
bool emulator = await FlutterEssential.isEmulator();
print('VPN: \$vpn, Internet: \$internet, Emulator: \$emulator');
await FlutterEssential.shareToAllApps(content: "Sharing to all apps!");
await FlutterEssential.shareToSpecificApp(
content: "Sharing to WhatsApp!",
app: SharingApp.whatsapp,
);
}
Add the following permissions to your AndroidManifest.xml
file:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />