getBatteryLevel method
Implementation
@override
Future<String?> getBatteryLevel() async {
if (!Platform.isAndroid) {
throw Exception('Available only for Android');
}
try {
final result =
await methodChannel.invokeMethod<String>('getBatteryLevel');
return result;
} catch (e) {
throw Exception('[MethodChannelError] ${e.toString()}');
}
}