Skip to content
pubscout

gql

1.0.1, released a year ago by gql-dart.dev

Parse, transform and print GraphQL documents in Dart.

WASM-readyQuiet but busy
$ flutter pub add gql
Source repository

What it does

Provides libraries to parse GraphQL strings into an AST, visit and transform the AST, and print it back to a string. Includes experimental schema and operation helpers.

AI-written summary of version 1.0.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to work with GraphQL query documents at build‑time or runtime without a full client
  • You want to generate or modify GraphQL queries programmatically

Skip it when

  • You need a complete GraphQL client with networking and caching
  • You require code‑generation of Dart models from GraphQL schemas

Strengths

  • Lightweight and pure‑Dart
  • Supports parsing, visiting, transforming and printing of GraphQL AST
  • Works on all Dart platforms

Weaknesses

  • No networking or execution layer
  • Experimental schema/operation APIs may change

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
4
import 'package:gql/language.dart' as lang;
import 'package:gql/ast.dart' as ast;

void main() {
  final ast.DocumentNode doc = lang.parseString('''
    query UserInfo($id: ID!) {
      user(id: $id) { id name }
    }
  ''');
  print(lang.printNode(doc));
}

Alternatives

Packages that do the same job and could replace gql.

  • printing

    Plugin to generate and print PDFs on Android, iOS, macOS, Windows, Linux and web

  • dartframe

    A data manipulation and analysis library inspired by Pandas and NumPy for Dart and Flutter.

Works with

Packages commonly used together with gql: ones it builds on, ones built on it, and its own family.