The example adds the platform-specific code inside
the main app itself.  If you want to reuse the
platform-specific code for multiple apps,
the project creation step is slightly different
(see developing packages),
but the platform channel code
is still written in the same way.

Note:
  The full, runnable source-code for this example is
  available in /examples/platform_channel/
  for Android with Java, iOS with Objective-C,
  Windows with C++, and Linux with C.
  For iOS with Swift,
  see /examples/platform_channel_swift/.

Step 1: Create a new app project

Start by creating a new app:

In a terminal run: flutter create batterylevel

By default, our template supports writing Android code using Kotlin,
or iOS code using Swift. To use Java or Objective-C,
use the -i and/or -a flags:

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