Models only
helpers: false · queries: falseGenerate response and input types while another tool owns the request document.
0.1.0-alpha.6Prerelease · 0.1.0-alpha.6 · Dart ^3.10.0
dartpollo_generator turns local schema and operation files into typed Dart models and GraphQL documents. Use the generated code with your GraphQL client or the optional dartpollo runtime.
dartpollo_generator generates models and documents through build_runner. json_serializable adds their JSON serializers.
dartpollo provides an optional HTTP client and cache. Both packages use the shared types in dartpollo_annotation.
build.yaml associates an SDL schema with lib/graphql/viewer.graphql.dart run build_runner build invokes Dartpollo Generator and json_serializable.lib/__generated__/viewer.graphql.dart contains Viewer$Query and VIEWER_QUERY_DOCUMENT; the paired .g.dart contains serializers.package:graphql, or execute the generated ViewerQuery with the optional Dartpollo client.query Viewer {
viewer {
login
}
}lib/main.dartfinal data = Viewer$Query.fromJson(result.data!);
print(data.viewer.login);Read response fields through typed Dart properties such as data.viewer.login.
helpers: false · queries: falseGenerate response and input types while another tool owns the request document.
helpers: false · queries: trueUse the generated AST, operation name, variables, and parser with package:graphql or another compatible client.
helpers: trueGenerate a GraphQLQuery wrapper for DartpolloClient and DartpolloCachedClient.
QueryOptions.Generator referenceLook up configuration options and defaults.