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
- [SOLVED] OAuth With Google & Flutter
Hi all, I'm trying to sign in with google and it all goes swimmingly until the call back. I get a new user created on the appwrite dashboard however the flutte...
- Realtime with multiple connections
I need the Realtime on multiple Collections for diffrent applicational logic. So my question is: Is there a way to have only 1 Websocket connection or do I need...
- Can't login or deploy functions in Appwr...
Hello, since i updatet to the appwrite cli 6.1.0 i can't login or deploy functions with the cli. When i call the command: "appwrite get account --verbose" i ge...