dart_gen 0.1.19

dart_gen #

Generate dart data schema from graphql queries, mutations and fragments

example/main.dart

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:


dependencies:
  dart_gen: ^0.1.19

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';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
2
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
43
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, other

Primary library: package:dart_gen/dart_gen.dart with components: io.

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.

Format lib/dart_gen.dart.

Run dartfmt to format lib/dart_gen.dart.

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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.3.0 <3.0.0
dart_style ^1.0.0 1.2.9
glob ^1.1.7 1.1.7
graphql_ast_visitor ^0.1.1 0.1.1
http ^0.12.0 0.12.0+2
path ^1.6.2 1.6.2
Transitive dependencies
analyzer 0.37.0
args 1.5.2
async 2.2.0
charcode 1.1.2
collection 1.14.11
convert 2.1.1
crypto 2.0.6
csslib 0.16.1
front_end 0.1.20
graphql_parser 1.1.3
html 0.14.0+2
http_parser 3.1.3
kernel 0.3.20
meta 1.1.7
package_config 1.0.5
pub_semver 1.4.2
source_span 1.5.5
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+12
yaml 2.1.16
Dev dependencies
pedantic ^1.0.0 1.8.0+1
test ^1.0.0

Admin