-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
graphql-flutter #11
Comments
Hi there, thanks for the kind words. I don't see where your confusion is so maybe I'm missing something. You are right that it can be done in a more "service-wrapped" way. Services just wrap functionality so to keep your code less dependent on a third party library you can create your class GraphQLService {
GraphQLClient _client;
Future<Posts> getPosts() {
var result = _client.query(...);
return Post.fromResult(results);
}
} And then you inject your Service as a normal independent provider Provider.value(value: GraphQLService()); Then you just inject that into the model as we do with all the other services. Does that answer your question. If it doesn't please be a bit more specific on what you're doing, what's happening and what you're expecting in terms of your architecture then I'll see if I can come up with a better solution. |
Thanks for the quick response. My major issue was to get the token (created/saved by the AuthService) into the
|
Yes that should definitely work. Goodluck, I'm happy to see the architecture being used. If you run into any kind of architectural limitations please let me know so that I can see what the best way would be to handle that situation. |
hey there. first of all, thank you so much for you effort on bringing flutter architecture to the next level.
I've just followed your tutorial
#14
and i am trying to implementgraphql-flutter
within the proposed architecture. I have a service (ApiGraphqlService
) which depends on theAuthenticationService
and should be consumed in e.g.PostViewModel
.I've already found a possible solution: zino-hofmann/graphql-flutter#339. But i thought it could be done a more "proper way"?
The text was updated successfully, but these errors were encountered: