battery_info 1.0.0 battery_info: ^1.0.0 copied to clipboard
Flutter plugin providing detailed information about the device battery (level, health, charging status, etc.). Currently only supports Android
Battery Info #
Flutter plugin, inspired by battery package, providing detailed information about the device battery (level, health, charging status, etc.).
Currently only supports Android (IOS coming in the future)
Usage #
To use this plugin, add battery_info
as a dependency in your pubspec.yaml file.
Example #
// Import package
import 'package:battery/battery_info.dart';
// Access current battery health
print("Battery Level: ${(await BatteryInfoPlugin.batteryInfo.health)}");
BatteryInfoPlugin.batteryInfoStream.listen((BatteryInfo batteryInfo) {
print("Charge time remaining: ${(data.chargeTimeRemaining / 1000 / 60).truncate()} minutes");
});
API reference can be found here: API reference