gql
gql copied to clipboard
Libraries supporting GraphQL in Dart
gql-dart/gql
This is an effort to advance the Dart GraphQL ecosystem.
It consists of multiple packages and libraries centered around GraphQL AST.
Core
The core of this project is the GraphQL parser which parses GraphQL strings into an AST. The parsed AST can then be transformed, visited and printed back to GraphQL string.
Code generation
GraphQL language enables code generation to speed up development and move document processing to build-time.
We provide code builders to generate Dart source code and file builders which easily plug into standard Dart code generation pipeline.
Ideas for future work:
- Typed resolvers for field resolution on the client or server
Pub | Package | Library | Description |
---|---|---|---|
package:gql_code_builder |
Various builders | ||
package:gql_build |
File builders |
Client
To enable development of GraphQL clients, we provide type definitions used to execute GraphQL operations. They include AST-based operation, request with per operation context, and response. These types are used by the Links.
Link is the current client implementation. Link is GraphQL AST-aware request/response middleware. They can be used to build a pipeline to deduplicate requests, conditionally transform requests and responses (including the context), and eventually send the requests to the server.
Ideas for future work:
- websocket link for subscriptions
- batched request HTTP link
- retry link to handle network issues transparently
- link for client-side request resolution
Other
Pub | Package | Library | Description |
---|---|---|---|
package:gql_pedantic |
Lint rules used by all gql-dart/gql packages |
Examples
Pub | Package | Library | Description |
---|---|---|---|
package:gql_example_cli |
Example usage in a CLI environment | ||
package:gql_example_flutter |
Example usage in a Flutter environment |
Users
Project | Description |
---|---|
artemis | Build dart types from GraphQL schemas and queries (using Introspection Query). |
graphql | A stand-alone GraphQL client for Dart, bringing all the features from a modern GraphQL client to one easy to use package. |
graphql_flutter | A GraphQL client for Flutter, bringing all the features from a modern GraphQL client to one easy to use package. |
normalize | Normalization and denormalization of GraphQL responses in Dart |
ferry | GraphQL Client for Dart |
graphql_server | Base package for implementing GraphQL servers. |
graphql-to-dart | generate dart classes and respective JsonSerializable transcoders (npm package) |
major_graphql | generate built_value classes and serializers with pub build (successor of graphql-to-dart) |
Your project? | Open a PR to add it to this readme! |
Contributing
The goal of this project is to expand Dart GraphQL ecosystem and to build a community around this vendor-neutral implementation.
Community contributions are welcome.
multipack
This repo uses multipack
. To activate it run the following command.
pub global activate multipack
multipack
provides a simple way of running commands in multiple packages at once. It builds a directed graph of packages
to run commands in topological order.
Link all local packages by running
multipack pubspec override
Get all packages by running
multipack pub get
Clean up the pubspec file before publishing
multipack pubspec clean
See more usage examples in .github/workflows/dart.yml.
Features and bugs
Please file feature requests and bugs at the GitHub.