Flutter Awesome Notifications PlatformException Unknown Error
1,116
Finally found what was wrong, this line:
bigPicture: 'assets://assets/frediLogoSlogan.png'
should be:
bigPicture: 'asset://assets/frediLogoSlogan.png',
The error description was only given if I tried on the android simulator. So give that a try of no error description is given.
Author by
Tomas Ward
Updated on December 02, 2022Comments
-
Tomas Ward over 1 year
I followed ResoCoder's guide on how to set up everything having to do with the Awesome Notifications Plugin. When I try creating a new basic notification, this error is called:
My Code to Initialize
AwesomeNotifications().initialize('resource://drawable/res_notification_logo', [ NotificationChannel( channelKey: 'basic_channel', defaultColor: Colors.tealAccent, channelName: 'Basic ' 'Notifications', importance: NotificationImportance.High, channelShowBadge: true, channelDescription: 'Basic notifications for Fredi.')]);
My Code To Call Notifications
Future<void> createBasicNotification() async { try { await AwesomeNotifications().createNotification( content: NotificationContent( id: createUniqueId(), channelKey: 'basic_channel', title: '${Emojis.money_coin} Test Notification Title', body: 'This is your first notification boy', bigPicture: 'assets://assets/frediLogoSlogan.png', notificationLayout: NotificationLayout.BigPicture)); } on PlatformException catch (error) { print("$error"); } }
Then I call:
onPressed: () async { print('pressed'); await createBasicNotification(); },
The Error (Output)
pressed
flutter: PlatformException(exception, Unknow error, The operation couldn’t be completed. (awesome_notifications.AwesomeNotificationsException error 1.), null)
I don't know what to fix as there is no description.
Please Help! Thanks!