On this page
Integration modes
Choose what Dartpollo generates based on the client you use.
Generation settings
generate_helpers and generate_queries both default to true.
| Helpers | Queries | Generated result | Use this when |
|---|---|---|---|
| false | false | Response, input, enum, and fragment types | Another tool owns the request document |
| false | true | Types, arguments, operation name, and DocumentNode | Using package:graphql or another AST-compatible client |
| true | false | Documents and Dartpollo wrappers are still emitted | Avoid this ambiguous combination |
| true | true | All generated artifacts plus GraphQLQuery wrappers | Using the optional Dartpollo clients |
Helpers require operation documents, so generate_helpers: true still causes constants to be emitted when generate_queries: false.
Models only
build.yaml
options:
generate_helpers: false
generate_queries: false
This removes the Dartpollo import and query wrapper. Parse a data map directly:
lib/main.dart
final viewer = Viewer$Query.fromJson({
'viewer': {'id': 'user-1', 'login': 'octocat'},
});
No operation constant or argument class is available in this mode, so application code must supply its own document and variable map.
Client-independent documents
build.yaml
options:
generate_helpers: false
generate_queries: true
optimize_document_nodes: false
This mode generates operation documents and names:
lib/generated/viewer.graphql.dart
final VIEWER_QUERY_DOCUMENT_OPERATION_NAME = 'Viewer';
final VIEWER_QUERY_DOCUMENT = DocumentNode(/* generated AST */);
Keep optimization false in alpha.6; see document limitations.
Follow the complete package:graphql guide for document, operationName, parserFn, and typed variables.
Dartpollo helpers
build.yaml
options:
generate_helpers: true
generate_queries: true
A wrapper such as ViewerQuery exposes document, operationName, getVariablesMap, and parse to DartpolloClient:
lib/main.dart
final response = await client.execute(ViewerQuery());
print(response.data?.viewer.login);
Follow the Dartpollo client guide to execute these helpers.
Client compatibility
Choose one runtime per package: graphql 5.2.x requires gql_dedupe_link 2.x, while Dartpollo alpha.6 requires 4.x. These versions cannot be installed together. The generator works with either client.