getBatteryLevel static method
Implementation
static Future<String> getBatteryLevel() async {
String batteryLevel;
try {
final int result = await _channel.invokeMethod('getBatteryLevel');
batteryLevel = 'Battery level: $result%.';
} on PlatformException {
batteryLevel = 'Failed to get battery level.';
}
return batteryLevel;
}