TypeDefinition class

The fundamental unit of any GraphQL Schema (spec).

There are six kinds of named type definitions in GraphQL, and two wrapping types.

The most basic type is a Scalar (ScalarTypeDefinition). A scalar represents a primitive value, like a string or an integer.

Oftentimes, the possible responses for a scalar field are enumerable. GraphQL offers an Enum (EnumTypeDefinition) type in those cases, where the type specifies the space of valid responses.

Scalars and Enums form the leaves in response trees; the intermediate levels are Object types (ObjectTypeDefinition), which define a set of fields,where each field is another type in the system, allowing the definition of arbitrary type hierarchies.

GraphQL supports two abstract types (AbstractType): interfaces and unions.

An Interface (InterfaceTypeDefinition) defines a list of fields; Object types that implement that interface are guaranteed to implement those fields. Whenever the type system claims it will return an interface, it will return a valid implementing type.

A Union (UnionTypeDefinition) defines a list of possible types; similar to interfaces, whenever the type system claims a union will be returned, one of the possible types will be returned.

Finally, oftentimes it is useful to provide complex structs as inputs to GraphQL field arguments or variables; the Input Object type (InputObjectTypeDefinition) allows the schema to define exactly what data is expected.

Inheritance
Implementers
Annotations

Constructors

TypeDefinition()
const

Properties

astNode TypeDefinitionNode
The underlying definition node from gql/ast.dart
read-only, override
description String
read-only
directives List<Directive>
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
name String
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(Object o) bool
The equality operator. [...]
inherited

Static Methods

fromNode(TypeDefinitionNode node) TypeDefinition