cancel method

Future<void> cancel(
  1. int id, {
  2. String? tag,
})

Cancel/remove the notification with the specified id.

This applies to notifications that have been scheduled and those that have already been presented.

The tag parameter specifies the Android tag. If it is provided, then the notification that matches both the id and the tag will be canceled. tag has no effect on other platforms.

Implementation

Future<void> cancel(int id, {String? tag}) async {
  if (kIsWeb) {
    return;
  }
  if (defaultTargetPlatform == TargetPlatform.android) {
    await resolvePlatformSpecificImplementation<
            AndroidFlutterLocalNotificationsPlugin>()
        ?.cancel(id, tag: tag);
  } else {
    await FlutterLocalNotificationsPlatform.instance.cancel(id);
  }
}