dart_gen 0.1.33

dart_gen #

Generate dart data schema from graphql queries, mutations and fragments


import 'package:dart_gen/dart_gen.dart';
import 'package:http/http.dart' as http;

Future<void> main() async {
  final client = http.Client();
  final res = await client.get('https://gitlab.com/-/graphql-explorer');
  final reg = RegExp(r'"X-CSRF-Token": "(.*?)"');
  final matched = reg.firstMatch(res.body);
  await deleteCache();
  await generateSchemas('https://gitlab.com/api/graphql',
      'dart_gen/example/*.gql', 'schema.dart', headers: {
        'X-CSRF-Token': '${matched.group(1)}'

Use this package as a library

1. Depend on it

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

  dart_gen: ^0.1.33

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:dart_gen/dart_gen.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.5

Health issues and suggestions

Document public APIs. (-1 points)

18 out of 18 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Maintenance issues and suggestions

Provide a file named CHANGELOG.md. (-20 points)

Changelog entries help developers follow the progress of your package. See the example generated by stagehand.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.3.0 <3.0.0
dart_style ^1.2.9 1.3.3
glob ^1.1.7 1.2.0
graphql_ast_visitor ^0.1.6 0.1.6
http ^0.12.0+2 0.12.0+4
path ^1.6.2 1.6.4
Transitive dependencies
_fe_analyzer_shared 1.0.3
analyzer 0.39.4
args 1.5.2
async 2.4.0
charcode 1.1.3
collection 1.14.12
convert 2.1.1
crypto 2.1.4
csslib 0.16.1
graphql_parser 1.1.4
html 0.14.0+3
http_parser 3.1.3
js 0.6.1+1
meta 1.1.8
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.1.0 2.0.0
pub_semver 1.4.3
source_span 1.6.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+13
yaml 2.2.0
Dev dependencies
pedantic ^1.0.0 1.9.0
test ^1.0.0