i’ not receiving fcm notification coming from node.js server to flutter


This Content is from Stack Overflow. Question asked by alaa

this is my flutter code:

Future<void> permi() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
var username = prefs.getString("username");
_fcm.getToken().then((value) => prefs.setString("fireToken", "$value!"));
var fireToken = prefs.getString("fireToken");
var token = prefs.getString("token");
await http
  headers:{"Content-Type": "application/json",
    "authorization": "$token"},
  body: jsonEncode({"username": username,"token": fireToken}),
    .then((value) => value)
    .catchError((e) => print(e));


Future checkprm()async{
NotificationSettings settings =
await _fcm.requestPermission(
  alert: true,
  announcement: false,
  badge: true,
  carPlay: false,
  criticalAlert: false,
  provisional: false,
  sound: true,
NotificationSettings set = await _fcm.getNotificationSettings();
if (settings.authorizationStatus == AuthorizationStatus.authorized) {
  print('User granted permission');
} else if (settings.authorizationStatus == AuthorizationStatus.provisional) {
  print('User granted provisional permission');
} else {
  print('User declined or has not accepted permission');
 void initState(){
  _fcm.getToken().then((value) => print("$value"));

this my node server :

 credential: admin.credential.cert(serviceAccount)

   async function sendNotif( title, body0,token){
    return await admin.messaging().sendMulticast({
    tokens: [token],
    notification: {
     title: title,
     body: body0
   data: {
     title: "This is a firebase message",
     message: "expo-notifications should be triggered",
    "hello": "world",
// Set Android priority to "high"
  android: {
   priority: "high",
// Add APNS (Apple) config
  apns: {
   payload: {

     aps: {
       "contentAvailable": true,
    headers: {

      "apns-push-type": "background",
      "apns-priority": "5", // Must be `5` when `contentAvailable` is set to true.
      "apns-topic": "io.flutter.plugins.firebase.messaging", // bundle identifier


i’ve been searching for a solution for about two weeks but it’s all for nothing.
the issue is that i don’t receive notifications coming from firebase if anyone found a solution please tell us. .


This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?