Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flutter run issues #5

Open
answer0732 opened this issue Oct 28, 2020 · 8 comments
Open

flutter run issues #5

answer0732 opened this issue Oct 28, 2020 · 8 comments

Comments

@answer0732
Copy link

hi, i am using this plugin for my app, but throw a problem

e: D:\flutter\.pub-cache\hosted\pub.flutter-io.cn\android_notification_listener2-2.0.1\android\src\main\kotlin\com\emilecode\android_notification_listener2\AndroidNotificationListener2Plugin.kt: (73, 28): Type mismatch: inferred type is String? but TypeVariable(V) was expected
e: D:\flutter\.pub-cache\hosted\pub.flutter-io.cn\android_notification_listener2-2.0.1\android\src\main\kotlin\com\emilecode\android_notification_listener2\AndroidNotificationListener2Plugin.kt: (74, 31): Type mismatch: inferred type is String? but TypeVariable(V) was expected
e: D:\flutter\.pub-cache\hosted\pub.flutter-io.cn\android_notification_listener2-2.0.1\android\src\main\kotlin\com\emilecode\android_notification_listener2\AndroidNotificationListener2Plugin.kt: (75, 28): Type mismatch: inferred type is String? but TypeVariable(V) was expected
e: D:\flutter\.pub-cache\hosted\pub.flutter-io.cn\android_notification_listener2-2.0.1\android\src\main\kotlin\com\emilecode\android_notification_listener2\AndroidNotificationListener2Plugin.kt: (76, 29): Type mismatch: inferred type is String? but TypeVariable(V) was expected

this is your code:

  internal inner class NotificationReceiver : BroadcastReceiver() {
    val TAG = "NOTIFICATION_RECEIVER"
    override fun onReceive(context: Context, intent: Intent) {
      val packageName = intent.getStringExtra(NotificationListener.NOTIFICATION_PACKAGE_NAME)
      val packageMessage = intent.getStringExtra(NotificationListener.NOTIFICATION_PACKAGE_MESSAGE)
      val packageText = intent.getStringExtra(NotificationListener.NOTIFICATION_PACKAGE_TEXT)
      val packageExtra = intent.getStringExtra(NotificationListener.NOTIFICATION_PACKAGE_EXTRA)
      val map = HashMap<String, Any>()
      map["packageName"] = packageName
      map["packageMessage"] = packageMessage
      map["packageText"] = packageText
      map["packageExtra"] = packageExtra
      eventSink?.success(map)
    }
  }

how to fix this, thanks !

@PavieOlivier
Copy link
Owner

Tell me , did you upgrade to the latest version of Android SDk and flutter ?. I suspect that it has to do with it.

However I am currently working on a project right now so I can't upgrade my environments yet I am sorry....

I will try to check that out though

@answer0732
Copy link
Author

yes, all upgrade to the latest version of Android SDk and flutter

@PavieOlivier
Copy link
Owner

Yeah I really suspect that it has to do with it . Once I do update everything on my side, I will try working on this package..
However it will take a long time because I am in the middle of an important project so updating now (because of numerous breaking changes) will cause lots of trouble to me....

However if you're on zoom we can have a video call... You fork the project and I will try to help you out

@answer0732
Copy link
Author

Sorry, I cannot make a video call with you. network restrictions in my place.
I'm not in a hurry to use it. I can wait, You can work on your project first, and good luck to you~!

@shinewanna
Copy link

e: E:\development\flutter\.pub-cache\hosted\pub.dartlang.org\android_notification_listener2-2.0.1\android\src\main\kotlin\com\emilecode\android_notification_listener2\AndroidNotificationListener2Plugin.kt: (73, 7): Type inference failed: Cannot infer type parameter V in inline operator fun <K, V> MutableMap<K, V>.set(key: K, value: V): Unit None of the following substitutions receiver: MutableMap<String, Any> arguments: (String,Any) receiver: MutableMap<String, String?> arguments: (String,String?) can be applied to receiver: kotlin.collections.HashMap<String, Any> /* = java.util.HashMap<String, Any> */ arguments: (String,String?)

having similar problem

@albertlieyingadrian
Copy link

Facing the same issue here

@OscSer
Copy link

OscSer commented Mar 23, 2021

e: E:\development\flutter\.pub-cache\hosted\pub.dartlang.org\android_notification_listener2-2.0.1\android\src\main\kotlin\com\emilecode\android_notification_listener2\AndroidNotificationListener2Plugin.kt: (73, 7): Type inference failed: Cannot infer type parameter V in inline operator fun <K, V> MutableMap<K, V>.set(key: K, value: V): Unit None of the following substitutions receiver: MutableMap<String, Any> arguments: (String,Any) receiver: MutableMap<String, String?> arguments: (String,String?) can be applied to receiver: kotlin.collections.HashMap<String, Any> /* = java.util.HashMap<String, Any> */ arguments: (String,String?)

having similar problem

I have the same problem

@qcasey
Copy link

qcasey commented Apr 1, 2021

e: E:\development\flutter\.pub-cache\hosted\pub.dartlang.org\android_notification_listener2-2.0.1\android\src\main\kotlin\com\emilecode\android_notification_listener2\AndroidNotificationListener2Plugin.kt: (73, 7): Type inference failed: Cannot infer type parameter V in inline operator fun <K, V> MutableMap<K, V>.set(key: K, value: V): Unit None of the following substitutions receiver: MutableMap<String, Any> arguments: (String,Any) receiver: MutableMap<String, String?> arguments: (String,String?) can be applied to receiver: kotlin.collections.HashMap<String, Any> /* = java.util.HashMap<String, Any> */ arguments: (String,String?)
having similar problem

I have the same problem

I fixed this by changing the line from

to

val map = mutableMapOf<String, String?>()

Which seems to have worked on Flutter 2.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants