Skip to content

Commit

Permalink
Merge pull request #136 from jxltom/update-docs
Browse files Browse the repository at this point in the history
Add docs about using cilent without widget
  • Loading branch information
eusdima authored Feb 16, 2019
2 parents f7d50ca + 2141518 commit efd9b55
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,31 @@ class MyApp extends StatelessWidget {
...
```

### Using Client Without Widget

You can using the GraphQL client directly to make queries or mutations without flutter widgets.

```dart
import 'dart:async';
import 'package:graphql_flutter/graphql_flutter.dart';
Client client = Client(
endPoint: 'https://api.github.com/graphql',
cache: InMemoryCache(),
apiToken: '<YOUR_GITHUB_PERSONAL_ACCESS_TOKEN>',
);
Future<Map<String, dynamic>> queryData() async {
Map<String, dynamic> data = await client.query(
readRepositories,
variables: {
'nRepositories': 50,
},
);
return data;
}
```

## Roadmap

This is currently our roadmap, please feel free to request additions/changes.
Expand Down

0 comments on commit efd9b55

Please # to comment.