zino-hofmann / graphql-flutter

A GraphQL client for Flutter, bringing all the features from a modern GraphQL client to one easy to use package.
https://zino-hofmann.github.io/graphql-flutter
MIT License
3.25k stars 619 forks source link

Decouple operation apis from flutter widgets #125

Closed dopecoder closed 5 years ago

dopecoder commented 6 years ago

Describe the bug When using scoped_model in flutter, i'm unable to return subscriptions as streams as the subscriptions are implemented as widgets.

Expected behavior Being able to subscribe without the use of flutter widgets.

Is there a way to just use pure dart for performing operations such as querying, subscribing and mutating as its not possible to subscribe date in scoped_model using widgets.

arnold-parge commented 6 years ago

Check the code in my issue: https://github.com/zino-app/graphql-flutter/issues/126

I am subscribing without Subscription widget.

micimize commented 5 years ago

@truongsinh is working on this, and it is critical for #72. Also from @feinstein:

if I want to make a Query on my BLoC or Reducer or ViewModel or any form of code that's not presentation, I can't

If this library can be used in a Model class, please also provide its use on the Readme. This is very helpful for unit testing and DI, where we can just simulate a query on a model class and serve it to a Presentation Widget.

For now I encourage anyone with urgent need to look into the widget implementations - you might be able to fit the client interaction points to whatever alternative pattern you're using. For instance, for basic Query and Mutation integration, the main things you'll have to port would be:

truongsinh commented 5 years ago

Separation MR at #203

micimize commented 5 years ago

@truongsinh contributed a bloc implementation example. This is similar enough to #72 that I'm going to close it in favor of there, as #203 will solve both at once