我正在嘗試實施本地通知,在我升級我的應用程式版本之前完美運行,如下所示:
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin;
showNotification() async {
var android = AndroidNotificationDetails(
'channel id', 'channel name');
var iOS = DarwinNotificationDetails();
var platform = NotificationDetails(android: android, iOS: iOS);
await flutterLocalNotificationsPlugin.periodicallyShow(0, 'Hello user,',
"Don't miss out on the exciting deals for the day.", RepeatInterval.everyMinute, platform);
}
但是自從我更改為flutter_local_notifications: ^10.0.0then 后,我再也無法收到任何通知。盡管我收到了一條錯誤訊息[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: NoSuchMethodError: The method 'periodicallyShow' was called on null.并且Tried calling: periodicallyShow(0, "Hello Hobber,", "Don't miss out on the exciting deals for the day.", Instance of 'RepeatInterval', Instance of 'NotificationDetails')有人可以幫忙嗎?
uj5u.com熱心網友回復:
像這樣初始化 FlutterLocalNotificationsPlugin 物件:
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin()
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/529314.html
標籤:扑本地通知
