large Flutter Favorite logosmall Flutter Favorite logo

battery_plus 3.0.2 icon indicating copy to clipboard operation
battery_plus: ^3.0.2 copied to clipboard

Flutter plugin for accessing information about the battery state(full, charging, discharging).

Battery Plus #

Flutter Community: battery_plus

pub package pub points battery_plus

A Flutter plugin to access various information about the battery of the device the app is running on.

Platform Support #

AndroidiOSMacOSWebLinuxWindows
✔️✔️✔️✔️✔️✔️

Usage #

To use this plugin, add battery_plus as a dependency in your pubspec.yaml file.

Example #

// Import package
import 'package:battery_plus/battery_plus.dart';

// Instantiate it
var battery = Battery();

// Access current battery level
print(await battery.batteryLevel);

// Be informed when the state (full, charging, discharging) changes
battery.onBatteryStateChanged.listen((BatteryState state) {
  // Do something with new state
});
232
likes
130
pub points
97%
popularity

Publisher

verified publisher iconfluttercommunity.dev

Flutter plugin for accessing information about the battery state(full, charging, discharging).

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

Icon for licenses.BSD-3-Clause (LICENSE)

Dependencies

battery_plus_platform_interface, flutter, flutter_web_plugins, meta, upower

More

Packages that depend on battery_plus