Hey, currently I dont seem to be able to find a way to give req and res in Future<void> start(final req, final res) a type which is pretty annoying. Are there any types for req and res I can use?`Something like AppwriteRequest or AppwriteResponse
We've had discussions about exposing the types. For now, maybe you can copy and paste this and cast the variables in your function body.
https://github.com/open-runtimes/open-runtimes/blob/main/runtimes/dart-2.17/function_types.dart
Casting doesnt work, 'im getting type 'Response' is not a subtype of type 'AppwriteResponse' in type cast'
class AppwriteRequest {
final Map<String, dynamic> variables;
final Map<String, dynamic> headers;
final String payload;
AppwriteRequest({
this.variables = const {},
this.headers = const {},
this.payload = '',
});
}
class AppwriteResponse {
int _status = 200;
dynamic _text;
int get status => _status;
dynamic get body => _text;
AppwriteResponse send(String? text, {int status = 200}) {
_text = text;
_status = status;
return this;
}
AppwriteResponse json(Map<String, dynamic> json, {int status = 200}) {
_text = json;
_status = status;
return this;
}
}
Womp. It still might be possible with a lot of hacking...
Yep, got it to work with this fancy hacky method:
T? castOrNull<T>(dynamic x) => x is T ? x : null;
AppwriteRequest? req = castOrNull<AppwriteRequest>(requ);
AppwriteResponse? res = castOrNull<AppwriteResponse>(resp);
Nvm, doesnt work :/
๐ ya...it might not be worth it to try and do that at the moment
Recommended threads
- I'm experiencing a critical bug on Appwr...
Hey <@870607367597850624> team / support ๐ I'm experiencing a critical bug on Appwrite Cloud that's blocking my production Flutter app. I've already filed GitH...
- context deadline exceeded
Hi, in one of my projects i continuously receive context deadline exceeded when trying to reach users API from my local machine: https://fra.cloud.appwrite.io/v...
- After a GET request is passed to functio...
Create execution in the console can normally retrieve the get parametersใWHy๏ผ