According to current documentation of flutter platfrom channel it seems only possible to call host (Native) from client (Dart) and then we get response from host. Is there any possiblity of its reverse, e.g. to call directly Client from host?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
This question already has an answer here:
Closed 11 months ago.
回答1:
Yes, this is possible using MethodChannel
.
You will to specify a call handler on your method channel by using setMethodCallHandler
.
As an example, the Java version of MethodChannel
has the invokeMethod
method just like the Dart class has. This means that you can use invokeMethod
on all platform. If you are calling it from native, you will have to set a method call handler in Flutter and vise versa.
On iOS it is exactly the same.