Skip to content
pubscout

upower

0.7.0, released 5 years ago by canonical.com

Provides a client to connect to UPower for Linux power management.

$ flutter pub add upower
Source repository

What it does

Provides a Dart client to connect to UPower, the Linux service responsible for power management. It allows developers to query daemon version, system state, devices, and power statistics.

AI-written summary of version 0.7.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to read battery levels and power states in a Flutter or Dart application on Linux.
  • You want to interact with the UPower DBus service without writing raw DBus queries.

Skip it when

  • Your application targets non-Linux platforms like Windows, macOS, iOS, or Android.
  • You only need general platform info not related to power management.

Strengths

  • Direct integration with the native Linux UPower service.
  • Simple API to query devices, percentages, and display state.

Weaknesses

  • Only supports Linux.
  • Requires the UPower service to be present on the host system.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
1

Requires the UPower D-Bus service to be available on the Linux host.

import 'package:upower/upower.dart';

var client = UPowerClient();
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}%');
}
await client.close();

Alternatives

Packages that do the same job and could replace upower.

Works with

Packages commonly used together with upower: ones it builds on, ones built on it, and its own family.