code_generators library

GraphLink — GraphQL code generation for Dart, Flutter, Java, TypeScript, and Spring Boot.

This library exposes the build_runner integration for Dart/Flutter projects. For CLI-based generation (recommended), see the glink binary.

build_runner usage

Add to pubspec.yaml:

dev_dependencies:
  graphlink: ^4.6.0
  build_runner: ^2.4.0

Configure build.yaml:

targets:
  $default:
    builders:
      graphlink|graphlinkGeneratorBuilder:
        options:
          packageName: my_app
          generateAllFieldsFragments: true
          autoGenerateQueries: true

Then run:

dart run build_runner build
# Install
dart pub global activate graphlink

# Generate (reads glink.json / glink.yaml / glink.yml automatically)
glink

# Watch mode
glink -w

Functions

graphlinkGeneratorBuilder(BuilderOptions options) → Builder
Creates a GraphlinkGeneratorBuilder configured with options from build.yaml.