4

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!

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

2

Make sure you have initialize and asked for permission to show notification

    await AwesomeNotifications().isNotificationAllowed().then((isAllowed) {
  if (!isAllowed) {
    AwesomeNotifications().requestPermissionToSendNotifications();
  }
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.