call

FlutterMethodCall

result

@escaping

FlutterResult

>

Void

in

// This method is invoked on the UI thread.

// Handle battery messages.

})

GeneratedPluginRegistrant

register

with

self

return

super

application

application

didFinishLaunchingWithOptions

launchOptions

Next, add the iOS Swift code that uses the iOS battery APIs to retrieve
the battery level. This code is exactly the same as you
would write in a native iOS app.

Add the following as a new method at the bottom of AppDelegate.swift:

private

func

receiveBatteryLevel

result