Skip to content

Anant00/graphql_to_dart

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphQL To Dart

Generate Dart models from an GraphQL endpoint by running a simple command.

Usage

Add graphql_to_dart as a dev dependency.

    graphql_to_dart: 1.0.0

Create a graphql_config.yaml file in your project root directory.

A simple graphql_config.yaml file will look something like this:

    package_name: my_awesome_app
    graphql_endpoint: https://example.com/graphql
    models_directory_path: lib/graphql/models/
    type_override:
      id: int

Note: All options except type_override and dynamic_import_path are required.

Run the command flutter packages pub run graphql_to_dart if you are using Flutter, otherwise simply pub run graphql_to_dart.

You can find the generated models in the path you provided to models_directory_path argument in graphql_config.yaml.

When you set models_directory_path outside of lib/, import 'package:packagename/path/filename.dart'; is not applicable. Add option dynamic_import_path: false for import 'filename.dart'.

Milestones

  • Generate Models
  • Support Enum
  • Generate query, mutations and subscriptions strings compatible with graphql package.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 100.0%