[CLOSED] Unable to get the right syntax after days of research.
- 0
- Tools
- Flutter
- Self Hosted
- Functions
Currently, I cannot use the data sent by the Client to the Dart function (data is needed for decision making) and also I cannot format the response from the Dart function to the Client code as a Dart Map Object.
The goal in the Flutter code is to send a request to Dart function and get a response from the Dart function.
Flutter Code
functionId: 'validator',
body: jsonEncode({"Request": "Sign Up Phone Prefix"}),
xasync: false,
path: '/',
method: 'POST',
headers: {'X-Custom-Header': '123'});
phoneValidatorExecutor.then((response) {
// for decoding response from Dart function
final decoded = response.toMap();
print(decoded);
}).catchError((error) {
print(error);
});```
--------------------------------------
The goal in the dart function is to receive client input and decide what to send back to client, so I deliberately removed the if statement to know if Client input was received and I decided to send it (data) back to Client.
**Dart Function Code**
```Future<dynamic> main(final context) async {
final requestFromClient = context.req.query['Request'];
return context.res.json({
// normalUsersPriceDetailsSuperSet was declared in a lib file as Map and has data
"Status": normalUsersPriceDetailsSuperSet["Network Prefixes"],
"UserInput": requestFromClient['Request'],
});
}```
**I've been on all these for more than 8 days ðŸ˜**
Confirmation of code syntax, If they are correct.
Unable to get the right syntax after days of research.
You already have threads open. Do not create duplicate ones
[CLOSED] Unable to get the right syntax after days of research.
Recommended threads
- 1:1 relationship doesn’t sync after re-a...
Hi, I’m trying to use a two-way one-to-one relationship. It works fine when I create a record with the relationship set, and it also works when I unset it. But ...
- Upsert with setting permissions
Hi there, I am using self-hosted appwrite v1.7.4 and trying to use the bulk update stuff that was released with 1.7.x. Unfortunally I found that there is an ser...
- Function deployment failed: Unable to re...
Hi Appwrite team, I have been experiencing persistent errors when i attempt to push my appwrite functions. The logs on the deployment detail page on the console...