wake_on_lan 2.0.3 wake_on_lan: ^2.0.3 copied to clipboard
Send wake on LAN magic packets to devices on your local network.
import 'package:wake_on_lan/wake_on_lan.dart';
void main() async {
// Create the IPv4 broadcast address
String ip = '192.168.1.255';
String mac = 'AA:BB:CC:DD:EE:FF';
// Validate that the two strings are formatted correctly
if (!IPv4Address.validate(ip)) return;
if (!MACAddress.validate(mac)) return;
// Create the IPv4 and MAC objects
IPv4Address ipv4Address = IPv4Address.from(ip);
MACAddress macAddress = MACAddress.from(mac);
// Send the WOL packet
// Port parameter is optional, set to 55 here as an example, but defaults to port 9
WakeOnLAN.from(ipv4Address, macAddress, port: 55).wake();
}