how to get just success message in firebase cloud message array in flutter

127

You Can store your data in a Map Variable and then use the containsKey method of that map variable to assure that the "success" key exists or not. And if it does exists then print it using the below code.

Map m =   { "multicast_id": "72************", "success": 1, "failure": 0, "canonical_ids": 0, "results": [ { "message_id": "0:161*************" } ] };
  print(m.containsKey("success"));
  print(m['success']);
Share:
127
mideveloper
Author by

mideveloper

Updated on December 27, 2022

Comments

  • mideveloper
    mideveloper over 1 year

    I implement FCM to send a push notification with PHP which works well but I will like to know if there is a way I can get just the "success":1 from below

    { "multicast_id": 72************, "success": 1, "failure": 0, "canonical_ids": 0, "results": [ { "message_id": "0:161*************" } ] }

    Using flutter POST or is there a way I can just let it return just a string saying success.