Unverified Commit 87ee003f authored by Ayush Bherwani's avatar Ayush Bherwani Committed by GitHub

replaces deprecated api usage for android (#62515)

parent 26f9d734
...@@ -19,7 +19,7 @@ public class {{pluginClass}} implements FlutterPlugin, MethodCallHandler { ...@@ -19,7 +19,7 @@ public class {{pluginClass}} implements FlutterPlugin, MethodCallHandler {
@Override @Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) { public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
channel = new MethodChannel(flutterPluginBinding.getFlutterEngine().getDartExecutor(), "{{projectName}}"); channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "{{projectName}}");
channel.setMethodCallHandler(this); channel.setMethodCallHandler(this);
} }
......
package {{androidIdentifier}} package {{androidIdentifier}}
import androidx.annotation.NonNull; import androidx.annotation.NonNull
import io.flutter.embedding.engine.plugins.FlutterPlugin import io.flutter.embedding.engine.plugins.FlutterPlugin
import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodCall
...@@ -10,7 +10,7 @@ import io.flutter.plugin.common.MethodChannel.Result ...@@ -10,7 +10,7 @@ import io.flutter.plugin.common.MethodChannel.Result
import io.flutter.plugin.common.PluginRegistry.Registrar import io.flutter.plugin.common.PluginRegistry.Registrar
/** {{pluginClass}} */ /** {{pluginClass}} */
public class {{pluginClass}}: FlutterPlugin, MethodCallHandler { class {{pluginClass}}: FlutterPlugin, MethodCallHandler {
/// The MethodChannel that will the communication between Flutter and native Android /// The MethodChannel that will the communication between Flutter and native Android
/// ///
/// This local reference serves to register the plugin with the Flutter Engine and unregister it /// This local reference serves to register the plugin with the Flutter Engine and unregister it
...@@ -18,8 +18,8 @@ public class {{pluginClass}}: FlutterPlugin, MethodCallHandler { ...@@ -18,8 +18,8 @@ public class {{pluginClass}}: FlutterPlugin, MethodCallHandler {
private lateinit var channel : MethodChannel private lateinit var channel : MethodChannel
override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
channel = MethodChannel(flutterPluginBinding.getFlutterEngine().getDartExecutor(), "{{projectName}}") channel = MethodChannel(flutterPluginBinding.binaryMessenger, "{{projectName}}")
channel.setMethodCallHandler(this); channel.setMethodCallHandler(this)
} }
override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) { override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment