Remove @NonNull to avoid warning (#129472)

Otherwise android studio complains:

> Do not use @NonNull in Kotlin; the nullability is already implied by the Kotlin type MethodCall not ending with ?

![image](https://github.com/flutter/flutter/assets/5236035/0cc2e838-dbf9-409f-8fd8-d4e006f58be6)
This commit is contained in:
fzyzcjy 2023-06-30 05:34:31 +08:00 committed by GitHub
parent bda64b54e1
commit 92969ba8ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,12 +16,12 @@ class {{pluginClass}}: FlutterPlugin, MethodCallHandler {
/// when the Flutter Engine is detached from the Activity
private lateinit var channel : MethodChannel
override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
override fun onAttachedToEngine(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
channel = MethodChannel(flutterPluginBinding.binaryMessenger, "{{projectName}}")
channel.setMethodCallHandler(this)
}
override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
override fun onMethodCall(call: MethodCall, result: Result) {
if (call.method == "getPlatformVersion") {
result.success("Android ${android.os.Build.VERSION.RELEASE}")
} else {
@ -29,7 +29,7 @@ class {{pluginClass}}: FlutterPlugin, MethodCallHandler {
}
}
override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) {
channel.setMethodCallHandler(null)
}
}