Use the returned result to update the user interface state in _batteryLevel
inside setState.

Finally, replace the build method from the template to
contain a small user interface that displays the battery
state in a string, and a button for refreshing the value.

Step 3: Add an Android platform-specific implementation

Kotlin

Java

Start by opening the Android host portion of your Flutter app
in Android Studio:

Start Android Studio

Select the menu item File > Open…

Navigate to the directory holding your Flutter app,
and select the android folder inside it. Click OK.

Open the file MainActivity.kt located in the kotlin folder in the
Project view.

Inside the configureFlutterEngine() method, create a MethodChannel and call
setMethodCallHandler(). Make sure to use the same channel name as
was used on the Flutter client side.

import