battery_plus 6.2.1 copy "battery_plus: ^6.2.1" to clipboard
battery_plus: ^6.2.1 copied to clipboard

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

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 #

Android iOS MacOS Web Linux Windows

Requirements #

  • Flutter >=3.22.0
  • Dart >=3.4.0 <4.0.0
  • iOS >=12.0
  • MacOS >=10.14
  • Android compileSDK 34
  • Java 17
  • Android Gradle Plugin >=8.3.0
  • Gradle wrapper >=8.4

Usage #

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
});

// Check if device in battery save mode
// Currently available on Android, iOS, MacOS and Windows platforms only
print(await battery.isInBatterySaveMode);

Learn more #

450
likes
160
points
88.1k
downloads

Publisher

verified publisherfluttercommunity.dev

Weekly Downloads

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

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#battery #utils

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

battery_plus_platform_interface, flutter, flutter_web_plugins, meta, upower, web

More

Packages that depend on battery_plus