![](/img/trans.png)
[英]How to solve flutter_local_notifications PlatformException error?
[英]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.