showTextNotification method
Implementation
Future<void> showTextNotification(
String title,
String message,
String msgid,
String redirectUrl,
) async {
await createNotificationChannel();
if (redirectUrl == null ||
redirectUrl.isEmpty ||
!Uri.parse(redirectUrl).isAbsolute) {
redirectUrl = "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': redirectUrl, 'msgid': msgid, 'type': 'Text'});
await flutterLocalNotificationsPlugin.show(
requestCode,
title,
message,
platformChannelSpecifics,
payload: payload,
);
}