Skip to main content

graphql_gen_generator 0.1.2 copy "graphql_gen_generator: ^0.1.2" to clipboard
graphql_gen_generator: ^0.1.2 copied to clipboard

build_runner generator for graphql_gen: generates GraphQL field enums for classes annotated with @GenerateEnumFields.

example/README.md

Example #

A complete project — schema, graphql_gen.yaml, generated sources and tests — lives in the repository: https://github.com/azalimov/graphql_gen/tree/main/example

dart run graphql_gen_generator init     # writes graphql_gen.yaml
dart run graphql_gen_generator sync     # schema -> models, enums, builders
dart run build_runner build             # freezed, json_serializable, field enums
final query = GraphQLQueryBuilder()
    .withOperation(
      operationName: ApiQueryOperations.books,
      arguments: ApiQueryArguments.books(first: 10),
      fields: GraphQLFieldBuilder().withEnumFields(BookFields.values),
    )
    .build();

final books = (response['books'] as List)
    .map((json) => Book.fromJson(json as Map<String, dynamic>));
1
likes
150
points
1.12k
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

build_runner generator for graphql_gen: generates GraphQL field enums for classes annotated with @GenerateEnumFields.

Repository (GitHub)
View/report issues

Topics

#graphql #codegen #build-runner #freezed

License

MIT (license)

Dependencies

analyzer, args, build, gql, graphql_gen, http, path, source_gen, yaml

More

Packages that depend on graphql_gen_generator