getActiveNotifications method

  1. @override
Future<List<ActiveNotification>> getActiveNotifications()
inherited

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

The supported OS versions are

  • Android: Android 6.0 or newer
  • iOS: iOS 10.0 or newer
  • macOS: macOS 10.14 or newer

Throws a PlatformException with an unsupported_os_version error code on older OS versions. On Linux it will throw an UnimplementedError.

Implementation

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