showNotification static method

void showNotification({
  1. required RemoteMessage message,
  2. String? icon,
})

Implementation

static void showNotification({required RemoteMessage message, String? icon}) {
  if (Platform.isAndroid) {
    final _localNotify = FlutterLocalNotificationsPlugin();
    _localNotify.show(
        message.notification.hashCode,
        message.notification?.title,
        message.notification?.body,
        NotificationDetails(
            android: AndroidNotificationDetails(
                'high_importance_channel', 'High Importance Notifications',
                channelDescription:
                    'This channel is used for important notifications.',
                color: const Color(0xFF0E986F),
                importance: Importance.high,
                priority: Priority.high,
                icon: icon ?? '@mipmap/ic_launcher')),
        payload: jsonEncode(message.data));
  }
}