Error on Flutter App Terminal
Receiver: Instance of 'Execution'
Tried calling: response```
**Flutter Code**
```Future phoneValidatorExecutor = functions.createExecution(
functionId: 'priceListID',
body: jsonEncode("FetchList"),
xasync: true,
path: '/',
method: 'POST',
headers: {
'content-type': 'application/json',
},
);
phoneValidatorExecutor.then((response) {
dynamic decoded = json.decode(response.response);
if (kDebugMode) {
print(decoded.toString());
}
List air = decoded["Response"]["air"].values.toList();
}).catchError((error) {
if (kDebugMode) {
print("Error gotten from server: ${error.toString()}");
}
});```
**Dart Cloud Function Code**
```String requestType = "";
Future<dynamic> main(final context) async {
context.log('Hello, Logs!');
context.error('Hello, Errors!');
requestType = context.log(context.req.bodyRaw);
if (requestType == "validatorAndPriceList"){
return context.res.json({
"Status": normalUsersPriceDetailsSuperSet,
});
}
}```
In the latest version of the SDK, there is no response property. Either use the auto complete in the IDE to see what properties are available or read the docs
Execution has no response
I used auto complete but couldn't find anything
But is another parts of the codes correct? @Steven
What do you see when you try to auto complete?
Xasync should probably be false if you want the function response right away
hascode runtimeType toString() noSuchMethod
seems the doc has error< some paramters are not defined
Oh it's because you put Future phoneValidatorExecutor
...
Change Future to final
Future is short for Future<dynamic>
. When you use dynamic, you lose typing info
okay but the function is still not able to use request, I mean how do I receive the request sent to the dart function?
What's your code and what's the auto complete show now?
That sounds like a different question/problem
Also, there are problems with your function code. You're not parsing bodyRaw correctly
did not show related parameter
the code is same I just added Future<dynamic>
how do I pass it well?
No...I said DONT do that
i used final, same issue, I even printed runtimeType
, it was Future<Execution>
Can you share a screenshot?
Recommended threads
- Project in AppWrite Cloud doesn't allow ...
I have a collection where the data can't be opened. When I check the functions, there are three instances of a function still running that can't be deleted. The...
- Get team fail in appwrite function
I try to get team of a user inside appwrite function, but i get this error: `AppwriteException: User (role: guests) missing scope (teams.read)` If i try on cl...
- Function in Node.JS to monitor events ar...
Hello everyone. I'm creating my first Node.JS function, but I don't have much experience with node and javascript. I'm trying to create a function, that monito...