Question 1: I am trying to get values of various keys from a decoded map that was encoded to string. when I tried:
final decoded = json.decode(response.response);
myMap = decoded;
if (kDebugMode) {
print(decoded["S"][0]);
}
I kept getting the value of S but an index zero, even as 0 is also a key of another map on server
............
Question 2 Am unable to get more than one responses from the cloud function, only the last one is gotten as response, despite others are directly above it. I tried this:
res.json({
'MTN_CG_Values': mtnCGValues.toString(),
});
res.json({
'MTN_CG_Model': mtnCGModel.toString(),
});
what is mtnCGValues and mtnCGModel?
They are map @Steven
Though question 1 is resolved, remaining that of question 2
I discovered, in question 1 the map was converted to string via
.toString
Thanks for coming through
What's left is the second question
Would you pleas share what response.response is or exactly what mtnCGValues and mtnCGModel values are?
Okay
Map mtnCGModel = {
// the pattern is |quantity | network | network ID | amount
"0": ["MTN CG", 290, 170, "500MB", "30 DAYS", "1"],
"1": ["MTN CG", 291, 280, "1GB", "30 DAYS", "1"],
"2": ["MTN CG", 292, 550, "2GB", "30 DAYS", "1"],
"3": ["MTN CG", 293, 820, "3GB", "30 DAYS", "1"],
"4": ["MTN CG", 294, 1350, "5GB", "30 DAYS", "1"],
// "5": ["MTN", 294, 2500, "10GB", "30 DAYS"],
};
List mtnCGValues = [
"MTN CG 500MB",
"MTN CG 1GB",
"MTN CG 2GB",
"MTN CG 3gb",
"MTN CG 5GB",
];
so why are you doing decoded["S"]? It doesn't look like there is any "S" key
Recommended threads
- router_deployment_not_found
I updated my function a few times and now i am getting the error: router_deployment_not_found I even reverted back to my original code but i am still getting th...
- Cloud function deploy stucks in processi...
Been trying for the last hours to deploy my function but for whatever reason, alwasy stuck on processing!
- [SOLVED] curl error Number: 6 — function...
Hello, I invested a lot of time in this error in a fresh install of appwrite 1.8.1 and lasted until fix, this if for helping anyone that can have the same weird...