showNotification method
Implementation
Future<void> showNotification(
int id, String title, String body, String? payload) async {
const AndroidNotificationDetails androidNotificationDetails =
AndroidNotificationDetails(
'your_channel_id',
'your_channel_name',
channelDescription: 'your_channel_description',
importance: Importance.max,
priority: Priority.high,
);
const NotificationDetails notificationDetails = NotificationDetails(
android: androidNotificationDetails,
iOS: DarwinNotificationDetails());
if (await getNotificationStatus()) { // Use the private method
await flutterLocalNotificationsPlugin.show(
id, title, body, notificationDetails,
payload: payload);
} else {
AppLogs.showInfoLogs('Notification not sent');
}
}