showURLNotification method

Future<void> showURLNotification(
  1. String title,
  2. String message,
  3. String url,
  4. String msgid,
)

Implementation

Future<void> showURLNotification(
    String title, String message, String url, String msgid) async {
  createNotificationChannel();
  if (url == null || url.isEmpty || !Uri.parse(url).isAbsolute) {
    url = "https://www.leewaysoftech.com/";
  }
  int requestCode = msgid.hashCode;
  const NotificationDetails platformChannelSpecifics = NotificationDetails(
    android: AndroidNotificationDetails(
      channelID,
      'Personal Notifications',
      channelDescription: 'Description of personal notifications',
      importance: Importance.max,
      priority: Priority.high,
      playSound: true,
      icon: '@mipmap/notify_adaptive_fore',
    ),
  );
  String payload = jsonEncode({
    'url': url,
    'msgid': msgid,
    'type': 'URL' // Include the type here
  });
  await flutterLocalNotificationsPlugin.show(
    requestCode,
    title,
    message,
    platformChannelSpecifics,
    payload: payload, // Pass JSON string as payload
  );
}