battery_plus
7.1.2, released 7 weeks ago by fluttercommunity.dev
Access device battery level, state, and battery save mode across platforms.
What it does
Provides a Flutter plugin to read the current battery level and listen to changes in battery state (full, charging, discharging). It also allows checking whether the device is currently in battery save mode.
AI-written summary of version 7.1.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to display the device's current battery level to users.
- Your app needs to react to changes in charging state.
- You want to check or handle device battery save mode.
Skip it when
- You need deep hardware diagnostics beyond basic battery metrics.
Strengths
- Supports multiple platforms including Android, iOS, web, Windows, macOS, and Linux.
- Part of the well-maintained Flutter Community Plus plugins.
- Provides both a future-based property for current state and a stream for state changes.
Weaknesses
- Battery save mode check is only available on Android, iOS, macOS, and Windows.
- Requires specific minimum native versions and build tool configurations.
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
Requires minimum platform versions such as Flutter >=3.22.0, iOS >=13.0, macOS >=10.15, Java 17, and Kotlin 2.2.0 as specified in the requirements.
import 'package:battery_plus/battery_plus.dart';
var battery = Battery();
print(await battery.batteryLevel);
battery.onBatteryStateChanged.listen((BatteryState state) {
// Do something with new state
});Alternatives
Packages that do the same job and could replace battery_plus.
- package_info_plus
Flutter plugin to query app package info like version, build number and installer store.
93Compare - sensors_plus
Flutter plugin to access accelerometer, gyroscope, magnetometer, and barometer sensors.
96Compare - device_info_plus
Provides detailed information about the current device, make, model, and OS version.
93Compare - connectivity_plus
Discover the state of network connectivity (WiFi, mobile, ethernet) on Android, iOS, Web and desktops.
97Compare
Works with
Packages commonly used together with battery_plus: ones it builds on, ones built on it, and its own family.
- webbattery_plus depends on itLightweight bindings for browser APIs via JS interop
- upowerbattery_plus depends on itProvides a client to connect to UPower for Linux power management.
- stream_videoBuilt on battery_plusOfficial low-level client for Stream Video, supporting calls, audio rooms, and live streaming.
- xybrid_flutterBuilt on battery_plusRun ML models on-device or in the cloud with hybrid routing and streaming inference.
- carp_mobile_sensingBuilt on battery_plusMobile sensing framework for collecting sensor and device data via configurable probes.