Looking for a sample app or code snippet of how I can create a Appwrite Function execution passing some data, await and receive response synchronously using flutter SDK.
I am able to create an execution marking Async false but I am unable to receive a response. I am assuming I doing something wrong so I would really appreciate some help.
How are you sending the response from the function? Also, did you read the starter code (esp comments)? It contains pretty much everything you need to know about functions
I did and even tried writing it but the issue I run into is how to await a response client side. From what I can tell marking the call Async False doesn't help.
Docs mention " The returned object will return you the current execution status. You can ping the Get Execution endpoint to get updates on the current execution status."
If my function returns addition of 2 numbers, I want the response to be the sum and not the current status even if the function takes 2 secs to complete execution.
I suppose you're calling the function from a flutter app?
Yes
If so, just await the function call and do whatever you want with the response which is responseBody
Example:
final execution = await functions.createExecution(
functionId: myFunctionId,
body: data,
xasync: false,
path: '/',
method: 'POST',
// headers: {'X-Custom-Header': '123'},
);
final response = execution.responseBody;
I tried this sample code as well but it dint work. Have you actually used this ? Maybe I missed something and can try again.
Yes I have a project I'm working on that uses functions
Will try again and report back. Thanks
Recommended threads
- The file size is either not valid or exc...
Hello, I am receiving the following error when I am trying to deploy a function from my local. ``` > appwrite push functions --function-id xxxxxxxxx ℹ Info: Va...
- redirect_uri errors on flutter client
Hi all, I'm using the flutter client for my app to do appwrite auth and use the JWTs to send to my backend. When I try to sign in with SSO, I get this: https:/...
- How does sending email from the Appwrite...
I noticed that the pricing page mentions “Messages – 1000 per month” for the Free plan. Is this different from sending emails? When I try to send an email usin...