php - how to get just success message in firebase cloud message array in flutter
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.
Answer
Solution:
You Can store your data in a {-code-1}
Variable and then use the {-code-2}
method of that {-code-3}
variable to assure that the "{-code-4}
" {-code-5}
exists or not. And if it does exists then {-code-6}
it using the below code
.
{-code-1} m = { "multicast_id": "72************", "{-code-4}": 1, "failure": 0, "canonical_ids": 0, "results": [ { "message_id": "0:161*************" } ] };
{-code-6}(m.{-code-2}("{-code-4}"));
{-code-6}(m['{-code-4}']);
Source