showQuickChatNotification static method

Future<void> showQuickChatNotification(
  1. Map<String, dynamic> data
)

Implementation

static Future<void> showQuickChatNotification(
    Map<String, dynamic> data) async {
  final title = data['title'] ?? '';
  final body = data['body'] ?? '';

  await flutterLocalNotificationsPlugin.cancel(0);

  if (!messages.contains(body)) {
    messages.add(body);
  }

  await flutterLocalNotificationsPlugin.show(
      0,
      title,
      body,
      NotificationDetails(
        android: AndroidNotificationDetails(
          'chat_channel',
          'Chat Notifications',
          importance: Importance.high,
          playSound: true,
          priority: Priority.high,
          styleInformation: InboxStyleInformation(
            messages,
            contentTitle: title,
            summaryText: "Tap to open chat",
          ),
          onlyAlertOnce: true,
          setAsGroupSummary: true,
          groupKey: 'notification_group_key',
        ),
        iOS: DarwinNotificationDetails(
        )
      ));
}