showForegroundNotification static method
void
showForegroundNotification(- {required RemoteMessage remoteMessage,
- bool playSound = true,
- bool showBadge = true}
)
Implementation
static void showForegroundNotification({
required RemoteMessage remoteMessage,
bool playSound = true,
bool showBadge = true,
}) async {
await flutterLocalNotificationsPlugin.show(
remoteMessage.hashCode,
remoteMessage.notification?.title,
remoteMessage.notification?.body,
NotificationDetails(
android: AndroidNotificationDetails(
'default_notification_channel_id',
'Default Notification Channel Id',
playSound: playSound,
channelShowBadge: showBadge,
importance: Importance.max,
priority: Priority.max,
),
iOS: DarwinNotificationDetails(
presentSound: playSound,
presentBadge: showBadge,
),
),
payload: json.encode(
remoteMessage.data,
),
);
}