GraphQLEnumType<Value> class

A GraphQLType with only a predetermined number of possible values.

Though these are serialized as strings, they carry special meaning with a type system.

Inheritance
Available Extensions

Constructors

GraphQLEnumType(String name, List<GraphQLEnumValue<Value>> values, {String? description, GraphQLTypeDefinitionExtra<EnumTypeDefinitionNode, EnumTypeExtensionNode> extra = const GraphQLTypeDefinitionExtra.attach([])})
Default GraphQL enum definition constructor

Properties

astNode → TypeDefinitionNode?
If this was parsed from an ast, the node in that ast
no setterinherited
attachments GraphQLAttachments
Other custom values that may modify the execution, validation or introspection for this element
no setterinherited
description String?
A description of this enum type, for tools like GraphiQL.
final
extra GraphQLTypeDefinitionExtra<EnumTypeDefinitionNode, EnumTypeExtensionNode>
final
generic GenericHelp<Value>
Utility for working with the Value Generic type
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isNonNullable bool
true when the type can not be null
no setterinherited
isNullable bool
true when the type can be null
no setterinherited
name String
The name of this enum type.
final
printableName String
The name of this type with defaults for GraphQLWrapperType. Can be used as a name of another GraphQL type, useful for composing names for generic types, for example.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
values List<GraphQLEnumValue<Value>>
The defined set of possible values for this type.
final

Methods

coerceToInputObject() GraphQLType<Value, String>
Turns this type into one suitable for being provided as an input to a GraphQLObjectField.
override
deserialize(SerdeCtx serdeCtx, String serialized) → Value
Deserializes a serialized value.
override
getValue(String name) GraphQLEnumValue<Value>?
Returns the enum value with the given name
list() GraphQLListType<Value?, String>
Returns a GraphQLListType with the inner type set to this
inherited
nonNull() GraphQLNonNullType<Value, String>
Creates a non-nullable type that represents this type, and enforces that a field of this type is present in input data.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
nullable() GraphQLType<Value, String>
Returns a nullable type that represents this type. If the type is isNullable returns itself without changes.
inherited
serialize(Value value) String
Serializes a value.
override
serializeSafe(Object? value, {bool nested = true}) String
inherited
toString() String
A string representation of this object.
inherited
validate(String key, Object? _input) ValidationResult<String>
Performs type coercion against an input value, and returns a list of errors if the validation was unsuccessful.
override
when<O>({required O enum_(GraphQLEnumType<Value>), required O scalar(GraphQLScalarType<Value, String>), required O object(GraphQLObjectType<Value>), required O input(GraphQLInputObjectType<Value>), required O union(GraphQLUnionType<Value>), required O list(GraphQLListType), required O nonNullable(GraphQLNonNullType<Value, String>)}) → O
Executes any of the provided function with this as argument. The function executed depends on the type of this
inherited
whenMaybe<O>({O enum_(GraphQLEnumType<Value>)?, O scalar(GraphQLScalarType<Value, String>)?, O object(GraphQLObjectType<Value>)?, O input(GraphQLInputObjectType<Value>)?, O union(GraphQLUnionType<Value>)?, O list(GraphQLListType)?, O nonNullable(GraphQLNonNullType<Value, String>)?, required O orElse(GraphQLType)}) → O
Similar to when, but with optional arguments and a required default case orElse, which is executed when none of the provided functions match this
inherited
whenOrNull<O>({O? enum_(GraphQLEnumType<Value>)?, O? scalar(GraphQLScalarType<Value, String>)?, O? object(GraphQLObjectType<Value>)?, O? input(GraphQLInputObjectType<Value>)?, O? union(GraphQLUnionType<Value>)?, O? list(GraphQLListType)?, O? nonNullable(GraphQLNonNullType<Value, String>)?}) → O?
Similar to when, but with optional arguments. Returns null when none of the provided functions match this
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited