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

Android notification channel description should not be a required field #1306

Closed
kasl opened this issue Sep 9, 2021 · 1 comment · Fixed by #1268
Closed

Android notification channel description should not be a required field #1306

kasl opened this issue Sep 9, 2021 · 1 comment · Fixed by #1268

Comments

@kasl
Copy link

kasl commented Sep 9, 2021

Describe the bug
The description field is optional, according to the documentation. Previously, we created channels with an empty description, and after migrating the library to null safety, errors appeared when receiving the channels list:

PlatformException
PlatformException(error, Unsupported value: [Ljava.lang.StackTraceElement;@cafd342, null, java.lang.IllegalArgumentException: Unsupported value: [Ljava.lang.StackTraceElement;@cafd342
	at f.a.c.a.r.o(Unknown Source:396)
	at f.a.c.a.s.c(Unknown Source:37)
	at f.a.c.a.j$a$a.c(Unknown Source:10)
	at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.getNotificationChannels(Unknown Source:54)
	at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(Unknown Source:291)
	at f.a.c.a.j$a.a(Unknown Source:17)
	at io.flutter.embedding.engine.e.b.e(Unknown Source:57)
	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(Unknown Source:4)
	at android.os.MessageQueue.nativePollOnce(Native Method)
	at android.os.MessageQueue.next(MessageQueue.java:336)
	at android.os.Looper.loop(Looper.java:197)
	at android.app.ActivityThread.main(ActivityThread.java:7948)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)

or

_TypeError: type 'Null' is not a subtype of type 'String'
  File "platform_flutter_local_notifications.dart", line 331, in AndroidFlutterLocalNotificationsPlugin.getNotificationChannels.<fn>
  File "iterable.dart", line 412, in MappedListIterable.elementAt
  File "iterable.dart", line 341, in ListIterator.moveNext
  File "growable_array.dart", line 188, in new _GrowableList._ofEfficientLengthIterable
  File "growable_array.dart", line 150, in new _GrowableList.of
  File "array_patch.dart", line 50, in new List.of
  File "set.dart", line 118, in SetMixin.toList
  File "platform_flutter_local_notifications.dart", line 342, in AndroidFlutterLocalNotificationsPlugin.getNotificationChannels
  File "<asynchronous suspension>"
  File "notification_service.dart", line 77, in NotificationService._initializeChannels
  File "<asynchronous suspension>"
  File "notification_service.dart", line 66, in NotificationService._initialize

To Reproduce
https://github.com/MaikuB/flutter_local_notifications/blob/master/flutter_local_notifications/lib/src/platform_specifics/android/notification_channel.dart#L13

Снимок экрана 2021-09-09 в 14 03 31

Expected behavior
Android notification channel description should not be a required field.
https://developer.android.com/reference/android/app/NotificationChannel

@MaikuB
Copy link
Owner

MaikuB commented Sep 9, 2021

Thanks for identifying this, as this is a breaking change this requires a major version bump so I'll look at including this in the 9.0.0 release. As there's already a 9.0.0 prerelease at the moment, this will be where the fix will go at the moment. Note that this is currently remaining a prerelease until Android 12 becomes stable

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