In a terminal run: flutter create -i objc -a java batterylevel

Step 2: Create the Flutter platform client

The app’s State class holds the current app state.
Extend that to hold the current battery state.

First, construct the channel. Use a MethodChannel with a single
platform method that returns the battery level.

The client and host sides of a channel are connected through
a channel name passed in the channel constructor.
All channel names used in a single app must
be unique; prefix the channel name with a unique ‘domain
prefix’, for example: samples.flutter.dev/battery.

Next, invoke a method on the method channel,
specifying the concrete method to call using
the String identifier getBatteryLevel.
The call might fail—for example,
if the platform doesn’t support the
platform API (such as when running in a simulator),
so wrap the invokeMethod call in a try-catch statement.