isNotificationActiveOnStatusBar method

  1. @override
Future<bool> isNotificationActiveOnStatusBar({
  1. required int id,
})
override

Checks whether a notification with the specified ID is currently active on the device's status bar.

This method takes an integer id argument representing the ID of the notification to be checked. It returns a Future that resolves to a bool value indicating whether the specified notification is currently active on the device's status bar. If the notification is active, the value will be true. If the notification is not active, the value will be false.

This method can be used to check whether a specific notification is currently being displayed on the device's status bar. If the notification is not active, you may want to take appropriate action, such as re-creating the notification or displaying a message to the user.

The status bar is the system's list of shown notifications: Android's status bar, Notification Center on iOS and macOS, Action Center on Windows and the notification server on Linux.

Implementation

@override
Future<bool> isNotificationActiveOnStatusBar({required int id}) async {
  var success = await methodChannel.invokeMethod(
      CHANNEL_METHOD_IS_NOTIFICATION_ACTIVE, id);
  return success;
}