batteryPercent method
override
Get the remaining battery charge, as a percentage from 0 to 100, and whether the battery is currently charging.
var batteryPercent = await myPowerSensor.batteryPercent();
double percent = batteryPercent.percent;
bool isCharging = batteryPercent.isCharging;
For more information, see Power Sensor component.
Implementation
@override
Future<BatteryPercent> batteryPercent({Map<String, dynamic>? extra}) async {
final request = GetBatteryPercentRequest()
..name = name
..extra = extra?.toStruct() ?? Struct();
return await client.getBatteryPercent(request, options: callOptions);
}