showNotification static method

Future<int> showNotification(
  1. String title,
  2. String content,
  3. ReceivedInfo payload, {
  4. bool playSound = true,
  5. bool enableVibration = true,
})

Implementation

static Future<int> showNotification(
  String title,
  String content,
  ReceivedInfo payload, {
  bool playSound = true,
  bool enableVibration = true,
}) async {
  var androidNotificationDetails = AndroidNotificationDetails(
    '962464',
    'SoulChat',
    channelDescription: 'SoulChat Notice',
    icon: "@mipmap/ic_launcher",
    playSound: playSound,
    enableVibration: enableVibration,
    importance: Importance.max,
    priority: Priority.high,
    ticker: 'SoulChat Ticker',
  );
  var iosNotificationDetails = DarwinNotificationDetails(
    presentAlert: true,
    presentSound: playSound,
  );
  var notificationDetails = NotificationDetails(
    android: androidNotificationDetails,
    iOS: iosNotificationDetails,
  );
  id++;
  await _flutterLocalNotificationsPlugin.show(
    id,
    title,
    content,
    notificationDetails,
    payload: payload.payload!.toJsonString(),
  );
  return id;
}