mani_plugin 0.0.2
mani_plugin: ^0.0.2 copied to clipboard
A Flutter plugin to monitor battery health including level, charging status, temperature, and health status for Android and iOS.
mani_plugin #
A Flutter plugin to monitor battery health in real-time. Get battery level, charging status, temperature, and health status for both Android and iOS.
Features #
| Feature | Android | iOS |
|---|---|---|
| Battery Level | ✅ | ✅ |
| Charging Status | ✅ | ✅ |
| Temperature | ✅ | ❌ |
| Battery Health | ✅ | ❌ |
Installation #
Add this to your pubspec.yaml:
dependencies:
mani_plugin: ^0.0.1
Usage #
import 'package:mani_plugin/mani_plugin.dart';
final _plugin = ManiPlugin();
// Get battery level
int? level = await _plugin.getBatteryLevel();
print('Battery: $level%');
// Get charging status
String? status = await _plugin.getChargingStatus();
print('Status: $status');
// Get temperature (Android only)
double? temp = await _plugin.getBatteryTemperature();
print('Temperature: $temp°C');
// Get health (Android only)
String? health = await _plugin.getBatteryHealth();
print('Health: $health');
// Get everything at once
Map<String, dynamic>? info = await _plugin.getAllBatteryInfo();
print(info);
// Output: {level: 85, chargingStatus: charging, temperature: 28.5, health: good}
Platform Notes #
- Battery temperature and health are Android-only features.
They will return
nullon iOS. - Always handle null values safely in your code.