Pub Package

Provides a client to connect to UPower - the service that does power management on Linux.

import 'package:dbus/dbus.dart';
import 'package:upower/upower.dart';

var systemBus = DBusClient.system();
var client = UPowerClient(systemBus);
await client.connect();
print('Running UPower ${client.daemonVersion}');
print('System state: ${client.displayDevice.state}');
print('Devices:');
for (var device in client.devices) {
  print('  ${device.type} ${device.percentage}%');
}
client.close();
await systemBus.close();

Libraries

upower