cancel method
Cancels a single notification and its respective schedule.
The id
parameter is an int that represents the unique identifier of
the notification to cancel. This method cancels both the notification and
its associated schedule.
If the notification is already shown, it will be dismissed immediately. If the notification has not been shown yet but is scheduled to be shown in the future, the notification will be cancelled and the schedule will be removed.
This method returns a Future that resolves to void
.
Implementation
@override
Future<void> cancel(int id) async {
validateId(id);
await methodChannel.invokeMethod(CHANNEL_METHOD_CANCEL_NOTIFICATION, id);
}