groupNotifications method
Groups a list of notifications by their AppNotification.groupKey. Notifications without a groupKey are placed under the empty string key.
Implementation
Map<String, List<AppNotification>> groupNotifications(
List<AppNotification> notifications,
) {
final groups = <String, List<AppNotification>>{};
for (final n in notifications) {
final key = n.groupKey ?? '';
groups.putIfAbsent(key, () => []).add(n);
}
return groups;
}