πŸ–₯️ 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();