Flutter 如何在一段时间后取消计划以前计划的本地通知?

Flutter 如何在一段时间后取消计划以前计划的本地通知?,flutter,dart,localnotification,Flutter,Dart,Localnotification,我正在使用库每1小时安排一次本地通知。它按预期工作,但现在,我需要一种方法来启动/停止通知计划(例如,按下按钮) 我在文档中找不到有关取消预定通知请求的任何信息。中的“取消/删除通知”中给出了该信息 等待本地通知lugin.cancel(0)在取消/删除通知中给出 等待本地通知lugin.cancel(0)取消/删除通知 // cancel the notification with id value of zero await flutterLocalNotificationsPlugin.c

我正在使用库每1小时安排一次本地通知。它按预期工作,但现在,我需要一种方法来启动/停止通知计划(例如,按下按钮)

我在文档中找不到有关取消预定通知请求的任何信息。

中的“取消/删除通知”中给出了该信息

等待本地通知lugin.cancel(0)

在取消/删除通知中给出


等待本地通知lugin.cancel(0)

取消/删除通知

// cancel the notification with id value of zero
await flutterLocalNotificationsPlugin.cancel(0);
// 0 is your notification id
取消/删除所有通知

await flutterLocalNotificationsPlugin.cancelAll();

是的,这可以取消当前和将来的通知。只需确保通知id正确。

取消/删除通知

// cancel the notification with id value of zero
await flutterLocalNotificationsPlugin.cancel(0);
// 0 is your notification id
取消/删除所有通知

await flutterLocalNotificationsPlugin.cancelAll();

是的,这可以取消当前和将来的通知。请确保通知id正确。

谢谢您的回复,但这是为了取消id值为零的通知。确定,您需要根据其他参数取消通知吗?不,all.cancel()的作用是从通知栏中删除通知。我希望能够停止以后每小时都会弹出的通知,即使在执行
wait flatterLocalNotificationsPlugin.cancelAll()之后,通知也不会停止?在中,有一个感谢您的回复,但这是为了取消id值为zerook的通知。您需要根据其他一些参数取消?no all.cancel()的作用是从通知栏中删除通知。我希望能够停止以后每小时都会弹出的通知,即使在执行
wait flatterLocalNotificationsPlugin.cancelAll()之后,通知也不会停止?在中有一个