Note:
  This guide addresses using the platform channel mechanism
  if you need to use the platform’s APIs in a non-Dart language.
  But you can also write platform-specific Dart code
  in your Flutter app by inspecting the
  defaultTargetPlatform property.
  Platform adaptations lists some
  platform-specific adaptations that Flutter
  automatically performs for you in the framework.

Architectural overview: platform channels

Messages are passed between the client (UI)
and host (platform) using platform
channels as illustrated in this diagram:

Messages and responses are passed asynchronously,
to ensure the user interface remains responsive.

Note:
  Even though Flutter sends messages to and from Dart asynchronously,
  whenever you invoke a channel method, you must invoke that method on the
  platform’s main thread. See the section on threading
  for more information.