graphql_to_dart 1.0.1

  • Readme
  • Changelog
  • Installing
  • 61

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 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.

Milestones #

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

1.0.0 #

  • Initial version

1.0.1 #

  • Formatting

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  graphql_to_dart: ^1.0.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:graphql_to_dart/graphql_to_dart.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
21
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
61
Learn more about scoring.

We analyzed this package on Jul 9, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14

Analysis suggestions

Package not compatible with runtime flutter-web on web

Because:

  • package:graphql_to_dart/graphql_to_dart.dart that imports:
  • package:graphql_to_dart/src/graphql_to_dart_base.dart that imports:
  • package:graphql_to_dart/src/parsers/config_parser.dart that imports:
  • package:graphql_to_dart/src/models/config.dart that imports:
  • package:graphql_to_dart/src/constants/files.dart that imports:
  • dart:io

Package not compatible with runtime js

Because:

  • package:graphql_to_dart/graphql_to_dart.dart that imports:
  • package:graphql_to_dart/src/graphql_to_dart_base.dart that imports:
  • package:graphql_to_dart/src/parsers/config_parser.dart that imports:
  • package:graphql_to_dart/src/models/config.dart that imports:
  • package:graphql_to_dart/src/constants/files.dart that imports:
  • dart:io

Maintenance suggestions

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and graphql_to_dart.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
graphql ^3.0.1 3.0.2 4.0.0-alpha.1
recase ^3.0.0 3.0.0
yaml ^2.2.1 2.2.1
Transitive dependencies
charcode 1.1.3
collection 1.14.13 1.15.0-nnbd
convert 2.1.1
crypto 2.1.5
gql 0.12.3 0.12.4-alpha+1590789520945
http 0.12.1
http_parser 3.1.4
matcher 0.12.8
meta 1.2.1
mime 0.9.6+3
path 1.7.0
pedantic 1.9.1
quiver 2.1.3
rxdart 0.23.1 0.24.1
source_span 1.7.0
stack_trace 1.9.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0 1.3.0-nnbd
uuid_enhanced 3.0.2
websocket 0.0.5