Skip to main content

Non-Nullable

GraphQLNonNullType allows you to represent a non-nullable or required value. By default, all GraphQL Types are nullable or optional, if you want to represent a required input or specify that a given output is always present (non-null), you want to use the GraphQLNonNullType wrapping type.

GraphQL Specification

In GraphQL this is represented using the ! exclamation mark after a given type expression. In Dart you can use the nonNull() method present in each GraphQLType, which will return a non-nullable GraphQLNonNullType with it's inner type, the type from which nonNull was called. For example, graphQLString.nonNull() will be a String! in GraphQL.