graphql_server 1.0.0-beta

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 62

graphql_server

Base package for implementing GraphQL servers. You might prefer package:angel_graphql, the fastest way to implement GraphQL backends in Dart.

1.0.0-beta

  • First release.

example/main.dart

import 'package:graphql_schema/graphql_schema.dart';
import 'package:graphql_server/graphql_server.dart';
import 'package:test/test.dart';

void main() {
  test('single element', () async {
    var todoType = objectType('todo', fields: [
      field(
        'text',
        graphQLString,
        resolve: (obj, args) => obj.text,
      ),
      field(
        'completed',
        graphQLBoolean,
        resolve: (obj, args) => obj.completed,
      ),
    ]);

    var schema = graphQLSchema(
      queryType: objectType('api', fields: [
        field(
          'todos',
          listOf(todoType),
          resolve: (_, __) => [
                new Todo(
                  text: 'Clean your room!',
                  completed: false,
                )
              ],
        ),
      ]),
    );

    var graphql = new GraphQL(schema);
    var result = await graphql.parseAndExecute('{ todos { text } }');

    print(result);
    expect(result, {
      'todos': [
        {'text': 'Clean your room!'}
      ]
    });
  });
}

class Todo {
  final String text;
  final bool completed;

  Todo({this.text, this.completed});
}

Use this package as a library

1. Depend on it

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


dependencies:
  graphql_server: ^1.0.0-beta

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:graphql_server/graphql_server.dart';
  
Version Uploaded Documentation Archive
1.0.0-beta Oct 23, 2018 Go to the documentation of graphql_server 1.0.0-beta Download graphql_server 1.0.0-beta archive
Popularity:
Describes how popular the package is relative to other packages. [more]
29
Health:
Code health derived from static analysis. [more]
94
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
95
Overall:
Weighted score of the above. [more]
62
Learn more about scoring.

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

  • Dart: 2.1.0
  • pana: 0.12.10

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:graphql_server/graphql_server.dart.

Health suggestions

Fix lib/mirrors.dart. (-5.84 points)

Analysis of lib/mirrors.dart reported 12 hints, including:

line 221 col 39: 'Exclude' is deprecated and shouldn't be used.

line 257 col 1: 'Exclude' is deprecated and shouldn't be used.

line 259 col 26: 'Exclude' is deprecated and shouldn't be used.

line 260 col 38: 'Exclude' is deprecated and shouldn't be used.

line 271 col 26: 'Alias' is deprecated and shouldn't be used.

Maintenance suggestions

Package is pre-release. (-5 points)

Pre-release versions should be used with caution, their API may change in breaking ways.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <3.0.0
angel_serialize ^2.0.0 2.2.1+2
collection ^1.0.0 1.14.11
graphql_parser ^1.0.0 1.1.1
graphql_schema ^1.0.0 1.0.1
meta ^1.0.0 1.1.7
recase ^2.0.0 2.0.0+1
tuple ^1.0.0 1.0.2
Transitive dependencies
charcode 1.1.2
matcher 0.12.4
path 1.6.2
quiver 2.0.1
quiver_hashcode 2.0.0
source_span 1.5.1
stack_trace 1.9.3
string_scanner 1.0.4
term_glyph 1.1.0
Dev dependencies
test >=0.12.0 <2.0.0