Closed maherjaafar closed 3 years ago
### Solution
I was using sdk: ">=2.12.0-0 <3.0.0"
it uses Null-Safety
environment: sdk: ">=2.7.0 <3.0.0"
Also in AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\notifications-1.0.2+1\android\src\main\kotlin\dk\cachet\notifications\NotificationsPlugin.kt
Line(65):
Old:
val nameMatch = TextUtils.equals(packageName, componentName.packageName)
New:
val nameMatch = TextUtils.equals(packageName, componentName!!.packageName)
Remember to specify the plugin name in the title!
Huawei MediaPad T3 10 / Android 7.0
.\notifications\NotificationsPlugin.kt: (66, 76): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type ComponentName?
Code:
private fun permissionGiven(): Boolean { val packageName = context!!.packageName val flat: String = Settings.Secure.getString(context!!.contentResolver, ENABLED_NOTIFICATION_LISTENERS) if (!TextUtils.isEmpty(flat)) { val names = flat.split(":").toTypedArray() for (name in names) { val componentName = ComponentName.unflattenFromString(name) val nameMatch = TextUtils.equals(packageName, componentName.packageName) if (nameMatch) { return true } } } return false }