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
- HTTP POST to function returning "No Appw...
Hi everyone, I’m running into an issue with my self-hosted Appwrite instance. I’ve set up my environment variables (APPWRITE_FUNCTION_PROJECT_ID, APPWRITE_FUNC...
- Can't add dart 3.5 runtime
Modified the `.env` to enable dart 3.5 runtime on my self-hosted instance but still can't find the runtime when creating a new function. I manually pulled the i...
- How to verify an user using AppWrite Fun...
I have seen similar questions but none whose solutions serve me. I have a function to verify a user with their secret and their id: https://blahblah.appwrite.gl...