-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ApiMethod with async #29
Comments
@mmaquevice your |
My bad, I thought it didn't work but you're right! |
The problem with this is that you can't use the await keyword. I have an api method that does a request to a separate back-end server (i.e. elastic search) and would like to wait for the response before returning. Is there a work around for this? |
you can use await just add async on the function declaration class TestResponse {
int result;
}
@ApiMethod(name: 'test upload', path: 'test', method: 'GET')
Future<TestResponse> test() async {
int number = await new Future.value(12);
return new TestResponse()..result = number;
} |
How does this work from the client? You can't really have a Future of a Future.. can you? |
on the client side there is no difference. |
Within the client api, the client api returns a future already. You'd end up with Future of a Future |
No just a future |
Congrats for RPC ! :)
Are you planning to support async api method ?
e.g. :
The text was updated successfully, but these errors were encountered: