upower
0.7.0, released 5 years ago by canonical.com
Provides a client to connect to UPower for Linux power management.
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.
- flutter_foreground_task
Implement and manage foreground services on Android and iOS platforms.
89Compare - health_connector_hc_android
Android implementation of the health_connector plugin using Health Connect SDK.
75Compare - flutter_accessibility_service
Flutter plugin to interact with Android Accessibility Service for events and actions.
71Compare
Works with
Packages commonly used together with upower: ones it builds on, ones built on it, and its own family.
- dbusupower depends on itNative Dart D-Bus client for Linux and Windows.
- nmSame familyClient for interacting with Linux NetworkManager via D-Bus
- gsettingsSame familyClient to access GSettings database for storing user preferences on Linux.
- geoclueSame familyDart client for the GeoClue D-Bus geolocation service on Linux.
- bluezSame familyA Dart client for interacting with the Linux BlueZ Bluetooth stack via D-Bus.
- desktop_notificationsSame familySend Linux desktop notifications via DBus.
- xdg_desktop_portalSame familyA native Dart implementation of portals for Linux desktop applications.
- packagekitSame familyClient for connecting to PackageKit to manage Linux software packages.