gql_code_builder
0.15.3, released 3 weeks ago by gql-dart.dev
Dart code builder generating typed classes from GraphQL documents and SDL
What it does
Generates Dart code classes from GraphQL documents (.graphql) and GraphQL Schema Definition Language (SDL). It produces structured AST and source code definitions for variables, data classes, and serializers using code_builder. It primarily serves as the low-level foundation for build packages such as package:gql_build.
AI-written summary of version 0.15.3, based on the package's README and metadata. Report an inaccuracy
Use it when
- Building custom code-generation tools or custom builders for GraphQL documents and SDL in Dart
- Developing higher-level GraphQL tools or integrating with package:gql_build
Skip it when
- Needing an end-user code generation runner (use higher-level tools like package:gql_build instead)
- Not working with GraphQL schemas or ASTs
Strengths
- Integrates directly with code_builder and analyzer for fine-grained code generation
- Supports advanced GraphQL features like fragment spreads, inline fragments, and tristate values (null vs absent)
Weaknesses
- The API is explicitly unstable and intended primarily for internal use by package:gql_build
- Documentation and examples are minimal in the package README
Setup
- Kind
- Pure Dart
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 10
Requires setting up code generation infrastructure or integrating via build_runner and package:gql_build.
Alternatives
Packages that do the same job and could replace gql_code_builder.
- json_serializable
Automatically generate code for converting Dart classes to and from JSON.
94Compare - build
Package for authoring build_runner compatible code generators.
87Compare - build_version
Generate a Dart file with the package version at build time.
77Compare - source_gen
Source code generation builders and utilities for the Dart build system.
84Compare
Works with
Packages commonly used together with gql_code_builder: ones it builds on, ones built on it, and its own family.
- analyzergql_code_builder depends on itPerforms static analysis of Dart code for tool integration and embedding.
- built_valuegql_code_builder depends on itImmutable value types with builders, enum classes and JSON serialization for Dart.
- code_buildergql_code_builder depends on itA fluent, builder-based library for generating valid Dart code programmatically.
- built_collectiongql_code_builder depends on itImmutable collections based on SDK collections with builder pattern.
- gqlgql_code_builder depends on itParse, transform and print GraphQL documents in Dart.
- gql_http_linkSame familyHTTP link for executing GraphQL requests via JSON.
- normalizeSame familyNormalizes and denormalizes GraphQL responses to a cache-friendly map structure.
- gql_linkSame familyModular AST-based GraphQL request execution interface.