TypeDefinition class Null safety
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
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.
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.
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.
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;
Input Object type (InputObjectTypeDefinition) allows the schema to define exactly what data is expected.
- astNode → TypeDefinitionNode
The underlying definition node from
- description → String?
- hashCode → int
The hash code for this object. [...]
- name → String?
- runtimeType → Type
A representation of the runtime type of the object.