我该如何在Flutter中安排每月或每周通知?其目的是为了提醒用户某些事情...
这是我的代码:
void showMonthlyAtDayTime() async {
//var scheduledNotificationDateTime = DateTime.now().add(Duration(seconds: 10));
var time = Time(12, 6, 0);
var androidPlatformChannelSpecifics = AndroidNotificationDetails(
'alarm_notif',
'Scheduled notification', // name of the notif channel
'A scheduled notification', // description of the notif channel
icon: 'question',
largeIcon: DrawableResourceAndroidBitmap('question'),
);
var iOSPlatformChannelSpecifics = IOSNotificationDetails(
presentAlert: true,
presentBadge: true,
presentSound: true);
var platformChannelSpecifics = NotificationDetails(
android: androidPlatformChannelSpecifics,
iOS: iOSPlatformChannelSpecifics);
await flutterLocalNotificationsPlugin.showMonthlyAtDayTime(
0,
'Title',
'Body',
Day.Tuesday,
time,
platformChannelSpecifics);
}
代码中在 'wait flutterLocalNotificationsPlugin.showMonthlyAtDayTime' 行和 'Day.Tuesday' 行出现了 (红色) 下划线。
如何修改上述代码?以便用户每年每月仅收到一次关于某事的通知。