androidBatteryInfo property

Future<AndroidBatteryInfo?> get androidBatteryInfo

Returns the battery info as a single API call

Implementation

Future<AndroidBatteryInfo?> get androidBatteryInfo async {
  try {
    final batteryInfo = await methodChannel.invokeMethod('getBatteryInfo');
    final converted = AndroidBatteryInfo.fromJson(Map.from(batteryInfo));
    return converted;
  } on PlatformException catch (e) {
    print(e.message);
    return null;
  }
}