EN | RU
battery_plus_aurora
Original Readme.
Description
The Aurora implementation of battery_plus.
A Flutter plugin to access various information about the battery of the device the app is running on. This plugin provides a comprehensive API for monitoring battery status, charge level, power state, and battery-saving mode. Ideal for mobile applications on Aurora OS that need to optimize power consumption, display battery information to users, or adapt functionality based on battery status.
Quickstart: Basic Usage Example
import 'package:battery_plus/battery_plus.dart';
// Initialize the battery plugin
var battery = Battery();
// Get current battery level (0-100)
final batteryLevel = await battery.batteryLevel;
print('Battery Level: $batteryLevel%');
// Get current battery state
final batteryState = await battery.batteryState;
print('Battery State: $batteryState');
// Check if battery save mode is enabled
final isInBatterySaveMode = await battery.isInBatterySaveMode;
print('Battery Save Mode: $isInBatterySaveMode');
// Listen for battery state changes
battery.onBatteryStateChanged.listen((BatteryState state) {
print('Battery State Changed: $state');
});
Features
- Battery Level Monitoring - Get precise battery percentage (0-100%)
- Battery State Detection - Identify charging, discharging, full, or unknown states
- Power Save Mode Detection - Check if battery optimization mode is active
Contents
Installation and build
pubspec.yaml
dependencies:
battery_plus: ^6.2.0
battery_plus_aurora:
git:
url: https://developer.auroraos.ru/git/flutter/flutter-community-plugins/battery_plus_aurora.git
Compatibility
The plugin has been working correctly since the 5.0.0 version of the Aurora OS.
Terms of Use and Participation
The source code of the project is provided under the license, that allows it to be used in third-party applications.
To participate in the development of the project, please read the contributor agreement. If you plan to contribute your own source code to the project, you will need to accept the CLA agreement.
For information about contributors see AUTHORS.
Code of conduct is a current set of rules of the Open Mobile Platform which informs you how we expect the members of the community will interact while contributing and communicating.