getActiveNotifications method
Returns the list of active notifications shown by the application that haven't been dismissed/removed.
Throws a PlatformException
with an unsupported_os_version
error code when the OS version is older
than what is supported to have results returned. On platforms that don't
support the method at all, 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'],
bigText: p['bigText'],
))
.toList() ??
<ActiveNotification>[];
}