batteryLevel

100

))

Finally, complete the setMethodCallHandler() method added earlier.
You need to handle a single platform method, getBatteryLevel(),
so test for that in the call argument.
The implementation of this platform method calls
the iOS code written in the previous step. If an unknown method
is called, report that instead.

batteryChannel

setMethodCallHandler

({

weak

self

call

FlutterMethodCall

result

FlutterResult

>

Void

in

// This method is invoked on the UI thread.

guard

call

method

==

"getBatteryLevel"

else

result

FlutterMethodNotImplemented