mac_settings_flutter 0.0.1
mac_settings_flutter: ^0.0.1 copied to clipboard
A Flutter plugin to control macOS settings (Wi-Fi, Bluetooth, AirDrop) using Apple Shortcuts.
π₯οΈ mac_settings_flutter #
mac_settings_flutter is a Flutter package that allows you to remotely control macOS system settingsβsuch as Wi-Fi, Bluetooth, and AirDropβdirectly from your Flutter app. It works by leveraging Apple Shortcuts to trigger macOS automation from your mobile device.
π€ You can control these settings even while your Mac is in sleep mode β as long as your Mac and mobile device are connected to the same Wi-Fi network.
β¨ Features #
- β Toggle Wi-Fi on/off from your Flutter app
- β Toggle Bluetooth on/off from your Flutter app
- β Toggle AirDrop on/off from your Flutter app
- π Built using Apple Shortcuts for secure native control
- π» Seamless connection between your Mac and Flutter application
- π€ Works even when your Mac is in sleep mode, if both devices are on the same Wi-Fi network
Example Application Preview #
App Screenshots
π Getting Started #
Before using this package, make sure you meet the following prerequisites:
1. Install macOS Shortcuts #
This package uses Apple Shortcuts to interface with macOS system settings.
π You need to download and install the required shortcuts on your Mac.
π Download the required Shortcuts:
Once installed, these shortcuts allow the Flutter app to trigger macOS-level changes securely and reliably.
π¦ Installation #
Add the following to your pubspec.yaml:
dependencies:
mac_settings_flutter: ^<latest-version>
π§βπ» Usage #
1. Connect to your Mac #
Use the following code to authenticate and establish a connection with your Mac using its IP address, username, and password:
final String macIp = ipController.text;
final String username = userController.text;
final String password = passwordController.text;
isLoading = true;
notifyListeners();
macSettingFlutter.onAuthenticated = () {
Alerts.showInfoSnackBar("Authenticated successfully!");
Navigator.of(context).pushNamed(ControlMacPage.routeName);
};
macSettingFlutter.printTrace = (value) {
debugPrint("print trace: $value");
Alerts.showInfoSnackBar(value);
};
// Connect to Mac
await macSettingFlutter.connectMac(
ip: macIp,
userName: username,
macPassword: password,
);
2. Toggle Mac System Settings #
Once connected, you can toggle Wi-Fi, Bluetooth, and AirDrop using the MacSettingsController:
import 'package:mac_settings_flutter/mac_settings_flutter.dart';
final controller = MacSettingsFlutter();
// Toggle Wi-Fi
await controller.toggleWiFi();
// Toggle Bluetooth
await controller.toggleBluetooth();
// Toggle AirDrop
await controller.toggleAirDrop();