gql_link 1.0.0+1 copy "gql_link: ^1.0.0+1" to clipboard
gql_link: ^1.0.0+1 copied to clipboard

A simple and modular AST-based GraphQL request execution interface.

MIT License PRs Welcome Watch on GitHub Star on GitHub Watch on GitHub Discord

A modular AST-based GraphQL request execution interface.

A hypothetical Link setup

There are multiple ways to set up your link by using other links. Read more here.

Here's a simple example using Link.from:

import "package:gql_link/gql_link.dart";
import "package:gql_dedupe_link/gql_dedupe_link.dart";
import "package:gql_http_link/gql_http_link.dart";

import "./my_custom_link.dart";

void main () {
  final link = Link.from([
    MyCustomLink(),
    DedupeLink()
    HttpLink("/graphql"),
  ]);
}

To use a link to execute GraphQL operations, it must have been set up to end with a terminating link. In this case, it's HttpLink.

When your link is set up, your GraphQL operation must be wrapped in a Request and executed via link.request(request);

Links are designed to be composable. If you need to add a custom behavior, you can implement your own Link by extending the Link class. If you prefer functions over classes, you can use LinkFunction together with Link.function. If you have to route a request to some other links based on some set of conditions, Link.route(LinkRouter route) might be what you need.

Features and bugs #

Please file feature requests and bugs at the GitHub.

20
likes
160
points
84.5k
downloads

Publisher

verified publishergql-dart.dev

Weekly Downloads

A simple and modular AST-based GraphQL request execution interface.

Repository (GitHub)
View/report issues

Topics

#graphql #gql #gql-link

Documentation

API reference

License

MIT (license)

Dependencies

gql, gql_exec, meta

More

Packages that depend on gql_link