gql_http_link
1.2.0, released a year ago by gql-dart.dev
HTTP link for executing GraphQL requests via JSON.
What it does
Provides a terminating link that sends GraphQL operations over HTTP, handling JSON encoding/decoding and error mapping. It supports GET for queries, multipart uploads, and custom headers.
AI-written summary of version 1.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need a lightweight GraphQL client that talks to a standard HTTP endpoint.
- You prefer a composable link architecture over a monolithic client.
- You want fine‑grained control over request/response handling.
- You need to integrate with existing gql_link pipelines.
Skip it when
- You already use a full‑featured HTTP client like dio and want to avoid extra dependencies.
- You need advanced features like WebSocket subscriptions or gRPC support.
Strengths
- Zero‑dependency on heavy HTTP clients; uses Dart's http package.
- Fast JSON decoding via _JsonUtf8Decoder.
- Composable with other gql_link links.
- Supports multipart uploads and GET queries.
Weaknesses
- Limited to HTTP; no WebSocket support.
- No built‑in retry or caching logic.
- Requires manual error handling for non‑200 responses.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 6
Add dependency and import package; no build_runner needed.
import "package:gql_link/gql_link.dart";
import "package:gql_http_link/gql_http_link.dart";
final link = Link.from([HttpLink("/graphql")]);Alternatives
Packages that do the same job and could replace gql_http_link.
- http2
An HTTP/2 implementation in Dart for low-level transport and pooled HTTP/2 requests.
91Compare - dio
A powerful HTTP networking package for Dart and Flutter with interceptors and request cancellation.
92Compare - alice
Advanced HTTP network inspector and logger with a native UI for Flutter.
88Compare - native_dio_adapter
A Dio HTTP client adapter that uses native platform HTTP stacks via cupertino_http and cronet_http.
87Compare
Works with
Packages commonly used together with gql_http_link: ones it builds on, ones built on it, and its own family.
- http_parsergql_http_link depends on itA platform-independent package for parsing and serializing HTTP formats.
- gqlgql_http_link depends on itParse, transform and print GraphQL documents in Dart.
- gql_linkgql_http_link depends on itModular AST-based GraphQL request execution interface.
- normalizeSame familyNormalizes and denormalizes GraphQL responses to a cache-friendly map structure.
- gql_code_builderSame familyDart code builder generating typed classes from GraphQL documents and SDL
- gql_dio_linkSame familyA GraphQL terminating link to execute requests via Dio using JSON.
- gql_buildSame familyUseful builders for your GraphQL SDL and documents.
- gql_websocket_linkSame familyGraphQL WebSocket link for executing queries, mutations, and subscriptions.