簡體   English   中英

Flutter 很棒的通知 PlatformException 未知錯誤

[英]Flutter Awesome Notifications PlatformException Unknown Error

我遵循了 ResoCoder 的指南,了解如何設置與Awesome Notifications Plugin相關的所有內容。 當我嘗試創建新的基本通知時,此錯誤稱為:

我的初始化代碼

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.')]);

我的呼叫通知代碼

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");
      }
    }

然后我打電話:

onPressed: () async {
          print('pressed');
          await createBasicNotification();
        },

錯誤(輸出)

pressed

flutter: PlatformException(exception, Unknow error, The operation couldn't be completed. (awesome_notifications.AwesomeNotificationsException error 1.), null)

我不知道要修復什么,因為沒有描述。

請幫忙! 謝謝!

終於發現哪里不對了,這一行:

bigPicture: 'assets://assets/frediLogoSlogan.png'

應該:

bigPicture: 'asset://assets/frediLogoSlogan.png',

只有在android模擬器上試過才給出錯誤描述。 於是試了一下沒有給出錯誤描述。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM