getBatteryInfo method
Implementation
@override
Future<Map<String, dynamic>> getBatteryInfo() async {
Map<String, dynamic> result = <String, dynamic>{};
try {
final batteryInfo = await methodChannel
.invokeMethod<Map<dynamic, dynamic>>('getBatteryInfo');
return jsonDecode(_jsonEncoder.convert(batteryInfo));
} on PlatformException catch (error) {
return result
..addEntries(
[MapEntry("code", error.code), MapEntry("message", error.message)]);
}
}