graphql_schema 1.0.0-beta

  • Installing
  • Versions
  • 37



An implementation of GraphQL's type system in Dart. Supports any platform where Dart runs.


It's easy to define a schema with the helper functions:

final GraphQLSchema todoSchema = new GraphQLSchema(
    query: objectType('Todo', [
  field('text', type: graphQLString.nonNullable()),
  field('created_at', type: graphQLDate)

All GraphQL types are generic, in order to leverage Dart's strong typing support.


GraphQL types can serialize and deserialize input data. The exact implementation of this depends on the type.

var iso8601String = graphQLDate.serialize(new;
var date = graphQLDate.deserialize(iso8601String);


GraphQL types can validate input data.

var validation = myType.validate('@root', {...});

if (validation.successful) {
} else {


  • graphQLSchema - Create a GraphQLSchema
  • objectType - Create a GraphQLObjectType with fields
  • field - Create a GraphQLField with a type/argument/resolver
  • listType - Create a GraphQLListType with the provided innerType


All of the GraphQL scalar types are built in, as well as a Date type:

  • graphQLString
  • graphQLId
  • graphQLBoolean
  • graphQLInt
  • graphQLFloat
  • graphQLDate

Non-Nullable Types

You can easily make a type non-nullable by calling its nonNullable method.

List Types

Support for list types is also included. Use the listType helper for convenience.

/// A non-nullable list of non-nullable integers

Use this package as a library

1. Depend on it

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

  graphql_schema: "^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_schema/graphql_schema.dart';
Version Uploaded Documentation Archive
1.0.0-beta Jul 19, 2017 Go to the documentation of graphql_schema 1.0.0-beta Download graphql_schema 1.0.0-beta archive


We analyzed this package on Jun 19, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3


Describes how popular the package is relative to other packages. [more]
15 / 100
Code health derived from static analysis. [more]
55 / 100
Reflects how tidy and up-to-date the package is. [more]
66 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter, web, other

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


  • Maintain

    Changelog entries help clients to follow the progress in your code.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 25 errors 3 hints.

    Strong-mode analysis of lib/src/object_type.dart failed with the following error:

    line: 12 col: 3
    Invalid override. The type of 'GraphQLObjectType.validate' ('(String, Map<dynamic, dynamic>) → ValidationResult<Map<dynamic, dynamic>>') isn't a subtype of 'GraphQLType<Map<String, dynamic>, Map<String, dynamic>>.validate' ('(String, Map<String, dynamic>) → ValidationResult<Map<String, dynamic>>').

    Strong-mode analysis of lib/src/scalar.dart failed with the following error:

    line: 27 col: 1
    The class 'GraphQLScalarType' cannot implement both 'GraphQLType<Value, Serialized>' and 'GraphQLType<dynamic, dynamic>' because the type arguments are different.

    Similar analysis of the following files failed:

    • lib/src/schema.dart (error)
    • lib/graphql_schema.dart (hint)
    • lib/src/validation_result.dart (hint)
  • Package is pre-release.

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

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Maintain an example.

    None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use graphql_schema.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0
graphql_parser ^1.0.0 1.0.0+1
Transitive dependencies
charcode 1.1.1
path 1.6.1
source_span 1.4.0
string_scanner 1.0.2
Dev dependencies
test ^0.12.0