Skip to content

A small package that use the power of build_runner package to create simply dart classes from a GraphQL schema file.

License

Notifications You must be signed in to change notification settings

freewaymx/graphql_types_builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Graphql Types Builder

A small package that use the power of build_runner package to create simply dart classes from a GraphQL schema file.

This package is in beta. Use it with caution and file any potential issues you see

Features

  • Generate Dart Class from GraphQL Schema
  • Generate constructor fromMap for each generated dart class
  • Support custom data types (Non Graphql Native types)

Upcoming Features

  • Add support for GraphQL Queries
  • Add support for GraphQL Mutations
  • Add support for GraphQL Subscriptions
  • Generate toMap instance method
  • Improve readme file

Getting started

First you need to add the following dev_dependencies to your pubspec.yaml file.

dev_dependencies:
  build_runner:
  graphql_types_builder: ^0.1.0
  ...

Then create a build.yaml with the following content in your project's root path.

targets:
  your_project_name:your_project_name:
    builders:
      graphql_types_builder|graphqlTypesBuilder:
        enabled: True
        generate_for:
          - lib/src/**/*schema.graphql

Note you have to change your_project_name with your project's name, you can find it in the top section of your pubspec.yaml file.

And finally just be sure that you have a schema.graphql file inside of your lib/src folder

Usage

flutter packages pub run build_runner build

Contributing

This package is in beta. If you want to contribute ask to the package owners by sending an email or creating a Github discussion

Additional information

This is a package created and maintained by the FreeWay Mx team. If you have a suggestion or found an issue, don't hesitate in creating a new Github issue 😁

About

A small package that use the power of build_runner package to create simply dart classes from a GraphQL schema file.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages