Skip to main content

Leto Schema

An implementation of GraphQL's type system in Dart. Supports any platform where Dart runs. The decisions made in the design of this library were done to make the experience as similar to the JavaScript reference implementation as possible, and to also correctly implement the official specification.

Contains functionality to build all GraphQL types:

  • String
  • Int
  • Float
  • Boolean
  • GraphQLObjectType
  • GraphQLUnionType
  • GraphQLEnumType
  • GraphQLInputObjectType
  • GraphQLListType
  • GraphQLNonNullType

Of course, for a full description of GraphQL's type system, see the official specification: https://spec.graphql.org/draft/#sec-Type-System

Mostly analogous to graphql-js; many names are verbatim: https://graphql.org/graphql-js/type/

Usage

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

final todoSchema = GraphQLSchema(
query: objectType(
'Todo',
fields: [
field('text', graphQLString.nonNull()),
field('created_at', graphQLDate),
],
),
);

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

Table of Contents