GraphQLUnionType<P> class

A special GraphQLType that indicates that an input value may be valid against one or more possibleTypes.

All provided types must be GraphQLObjectTypes.

Inheritance
Available Extensions

Constructors

GraphQLUnionType(String name, Iterable<GraphQLObjectType> possibleTypes, {String? description, ResolveType<GraphQLUnionType<P>>? resolveType, Object extractInner(P)?, GraphQLTypeDefinitionExtra<UnionTypeDefinitionNode, UnionTypeExtensionNode> extra = const GraphQLTypeDefinitionExtra.attach([])})
Default GraphQL union 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 type, which, while optional, can be very useful in tools like GraphiQL.
final
extra GraphQLTypeDefinitionExtra<UnionTypeDefinitionNode, UnionTypeExtensionNode>
final
generic GenericHelp<P>
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 type.
final
possibleTypes List<GraphQLObjectType>
A list of all types that conform to this union.
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
resolveType ResolveTypeWrapper<GraphQLUnionType<P>>?
Used to provide type resolution at runtime
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

coerceToInputObject() GraphQLType<P, Map<String, dynamic>>
Turns this type into one suitable for being provided as an input to a GraphQLObjectField.
override
deserialize(SerdeCtx serdeCtx, Map<String, dynamic> serialized) → P
Deserializes a serialized value.
override
extractInner(P p) Object
When the union type is a wrapper around the real types associated to possibleTypes, this function extracts that value from the wrapper
list() GraphQLListType<P?, Map<String, dynamic>>
Returns a GraphQLListType with the inner type set to this
inherited
nonNull() GraphQLNonNullType<P, Map<String, dynamic>>
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<P, Map<String, dynamic>>
Returns a nullable type that represents this type. If the type is isNullable returns itself without changes.
inherited
serialize(P value) Map<String, dynamic>
Serializes a value.
override
serializeSafe(Object? value, {bool nested = true}) Map<String, dynamic>
inherited
toString() String
A string representation of this object.
inherited
validate(String key, Object? input) ValidationResult<Map<String, dynamic>>
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<P>), required O scalar(GraphQLScalarType<P, Map<String, dynamic>>), required O object(GraphQLObjectType<P>), required O input(GraphQLInputObjectType<P>), required O union(GraphQLUnionType<P>), required O list(GraphQLListType), required O nonNullable(GraphQLNonNullType<P, Map<String, dynamic>>)}) → 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<P>)?, O scalar(GraphQLScalarType<P, Map<String, dynamic>>)?, O object(GraphQLObjectType<P>)?, O input(GraphQLInputObjectType<P>)?, O union(GraphQLUnionType<P>)?, O list(GraphQLListType)?, O nonNullable(GraphQLNonNullType<P, Map<String, dynamic>>)?, 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<P>)?, O? scalar(GraphQLScalarType<P, Map<String, dynamic>>)?, O? object(GraphQLObjectType<P>)?, O? input(GraphQLInputObjectType<P>)?, O? union(GraphQLUnionType<P>)?, O? list(GraphQLListType)?, O? nonNullable(GraphQLNonNullType<P, Map<String, dynamic>>)?}) → 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