flutter-platform-channel

Get activity reference in flutter plugin

北城以北 提交于 2020-06-17 01:00:51
问题 When I created a flutter plugin, there are two methods in the plugin class by default: override fun onAttachedToEngine(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) and fun registerWith(registrar: Registrar) The comment on the file says : It is encouraged to share logic between onAttachedToEngine and registerWith to keep them functionally equivalent. Only one of onAttachedToEngine or registerWith will be called depending on the user's project. onAttachedToEngine or registerWith

Flutter both directions of platform channel call? [duplicate]

五迷三道 提交于 2019-12-02 07:30:08
问题 This question already has an answer here : Flutter: How to call methods in Dart portion of the app, from the native platform using MethodChannel? (1 answer) Closed 6 months ago . 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? 回答1: Yes, this is possible using MethodChannel. You will to specify a call