android_battery_level_plus 0.0.1 copy "android_battery_level_plus: ^0.0.1" to clipboard
android_battery_level_plus: ^0.0.1 copied to clipboard

A Flutter plugin to access the device's current battery level on Android.

android_battery_level_plus #

A Flutter plugin to access the device's current battery level on Android.

Features #

  • Get the current battery percentage of the Android device.
  • Easy-to-use API via Method Channels.
  • Lightweight and efficient.

Platform Support #

Platform Support
Android SDK 24+

Installation #

Add android_battery_level_plus to your pubspec.yaml:

dependencies:
  android_battery_level_plus: ^0.0.1

Usage #

Import the package:

import 'package:android_battery_level_plus/battery_plugin.dart';

Create an instance and call getBatteryLevel():

final _batteryPlugin = BatteryPlugin();

Future<void> fetchBattery() async {
  try {
    int? level = await _batteryPlugin.getBatteryLevel();
    print('Battery Level: $level%');
  } catch (e) {
    print('Failed to get battery level: $e');
  }
}

Example #

Check the example directory for a complete sample application.

6
likes
0
points
133
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin to access the device's current battery level on Android.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on android_battery_level_plus

Packages that implement android_battery_level_plus