showGroupedNotification method

Future<void> showGroupedNotification({
  1. required String title,
  2. required String body,
  3. required String groupKey,
  4. required String groupTitle,
  5. String? channelId,
  6. Map<String, dynamic>? payload,
  7. bool isSummary = false,
  8. int? notificationId,
})

Shows a grouped notification (Android)

Implementation

Future<void> showGroupedNotification({
  required String title,
  required String body,
  required String groupKey,
  required String groupTitle,
  String? channelId,
  Map<String, dynamic>? payload,
  bool isSummary = false,
  int? notificationId,
}) async {
  try {
    await _notificationService.showNotification(
      id: notificationId ?? DateTime.now().millisecondsSinceEpoch ~/ 1000,
      title: title,
      body: body,
      channelId: channelId,
      payload: payload,
      groupKey: groupKey,
      sortKey: isSummary ? 'summary' : 'notification',
    );

    _logMessage(
        '[NotificationManager] Grouped notification shown: $groupKey');
  } catch (error, stack) {
    _logMessage(
        '[NotificationManager] Show grouped notification error: $error');
    _logMessage('[NotificationManager] Stack trace: $stack');
  }
}