How do plugins work on iOS and Android?
Many plugins will work with the different underlying platforms to use operating system functionality. This dependency changes the way your project is built and run because there is native code within your project that interfaces with the underlying platform. Let's look at how that interfacing works.
MethodChannel
Flutter communication between the client (Flutter) and the host (native) application occurs through platform channels. The MethodChannel
class is responsible for sending messages (method invocations) to the platform side. On the platform side, MethodChannel
on Android (API) and FlutterMethodChannel
on iOS (API) enable receiving method calls and sending a result back. The structure of this relationship is shown in the following diagram.
The platform channel technique allows for the decoupling of the UI code from the platform-specific native code...