Comments (4)
Hi @sjmcdowall,
We are aware there is still a lack of documentation for this project. We're planning on creating some static docs.
Until then here are some pointers:
Updating http options though the context
You can update the http options (like headers) by passing them to context in the query. That would look something like this:
Query(
options: QueryOptions(
document: queries.readRepositories,
pollInterval: 4,
context: <String, dynamic>{
'headers': <String, String>{
'Authorization': 'Bearer <YOUR_PERSONAL_ACCESS_TOKEN>',
},
},
),
builder: (QueryResult result) {
...
},
);
Calling the client from outside a Flutter context
Although not (yet) documented, you can call the the client directly. The client exposes two methods: GraphQLClient.query
and GraphQLClient.mutate
. They both resolve a single query according to the options specified and return a Future
which resolves with the resulting data or throws an error.
HttpLink link = HttpLink(
uri: 'https://api.github.com/graphql',
headers: <String, String>{
'Authorization': 'Bearer <YOUR_PERSONAL_ACCESS_TOKEN>',
},
);
GraphQLClient client = GraphQLClient(
cache: InMemoryCache(),
link: link,
);
Future<QueryResult> queryResult = client.query(
QueryOptions(
document: queries.readRepositories,
),
);
Hope that helps! ✌🏻
from graphql-flutter.
why this is not on documented yet?
from graphql-flutter.
That is perfect and awesome doc! Can't wait to give it a whirl later today!!
from graphql-flutter.
from graphql-flutter.
Related Issues (20)
- Executing the same query in parallel only makes one request
- New release request to fix upstream bugs HOT 3
- How to return partial data from cache?
- Typo in packages/graphql/lib/src/core/policies.dart
- Update uuid version to ^4.0.0 HOT 4
- Subscription throws uncaught handshake exception when using http HOT 1
- Extreme slowness/jank with JSON scalar
- UUID Out of Date HOT 2
- Example needed for cache HOT 2
- Documentation not clear about uploading file HOT 1
- Connection closed before full header was recieved error HOT 2
- Invalid result data when two list items nearly identical HOT 1
- Graphql Subscription not working HOT 2
- Not able to Mock the Result of Query Widget
- GraphQLDataProxy usage example fails with PartialDataException(path: __typename) HOT 1
- OperationException thrown from a WatchQuery operation
- Make `connectivity
- Make `connectivity_plus` optional.
- Failed to lookup host
- Failed to lookup host on all versions error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-flutter.