getActiveNotifications method

Future<List<ActiveNotification>?> getActiveNotifications()

Returns the list of active notifications shown by the application that haven't been dismissed/removed.

This method is only applicable to Android 6.0 or newer and will throw an PlatformException when called on a device with an incompatible Android version.

Implementation

Future<List<ActiveNotification>?> getActiveNotifications() async {
  final List<Map<dynamic, dynamic>>? activeNotifications =
      await _channel.invokeListMethod('getActiveNotifications');
  return activeNotifications
      // ignore: always_specify_types
      ?.map((a) => ActiveNotification(
            a['id'],
            a['channelId'],
            a['title'],
            a['body'],
            tag: a['tag'],
          ))
      .toList();
}