onFirebaseNotificationReceived method

Future<void> onFirebaseNotificationReceived()

Implementation

Future<void> onFirebaseNotificationReceived() async{
  FirebaseMessaging.onMessage.listen((RemoteMessage message) {
    RemoteNotification? notification = message.notification;
    AndroidNotification? android = message.notification?.android;
    if (notification != null && android != null) {
      flutterLocalNotificationsPlugin.show(
          notification.hashCode,
          notification.title,
          notification.body,
          NotificationDetails(
            android: AndroidNotificationDetails(
              channel.id,
              channel.name,
              channel.description,
              icon: 'ic_launcher',
            ),
          ));
    }
  });
}