replaces deprecated api usage for android (#62515)

This commit is contained in:
Ayush Bherwani
2020-07-30 10:06:04 +05:30
committed by GitHub
parent 26f9d734e9
commit 87ee003f0c
2 changed files with 5 additions and 5 deletions

View File

@@ -19,7 +19,7 @@ public class {{pluginClass}} implements FlutterPlugin, MethodCallHandler {
@Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
channel = new MethodChannel(flutterPluginBinding.getFlutterEngine().getDartExecutor(), "{{projectName}}");
channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "{{projectName}}");
channel.setMethodCallHandler(this);
}

View File

@@ -1,6 +1,6 @@
package {{androidIdentifier}}
import androidx.annotation.NonNull;
import androidx.annotation.NonNull
import io.flutter.embedding.engine.plugins.FlutterPlugin
import io.flutter.plugin.common.MethodCall
@@ -10,7 +10,7 @@ import io.flutter.plugin.common.MethodChannel.Result
import io.flutter.plugin.common.PluginRegistry.Registrar
/** {{pluginClass}} */
public class {{pluginClass}}: FlutterPlugin, MethodCallHandler {
class {{pluginClass}}: FlutterPlugin, MethodCallHandler {
/// 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
@@ -18,8 +18,8 @@ public class {{pluginClass}}: FlutterPlugin, MethodCallHandler {
private lateinit var channel : MethodChannel
override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
channel = MethodChannel(flutterPluginBinding.getFlutterEngine().getDartExecutor(), "{{projectName}}")
channel.setMethodCallHandler(this);
channel = MethodChannel(flutterPluginBinding.binaryMessenger, "{{projectName}}")
channel.setMethodCallHandler(this)
}
override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {