A package for Dart code generation from GraphQL source.
Builders in this package let you build your GraphQL requests and view the response in a type-safe way.
See the gql_example_cli or gql_example_flutter for usage examples.
Generates an AST representation of a GraphQL Document
Generates a typed view of your data.
Creates data classes for any GraphQL variables used in a query or fragment.
tristate_optionals:
[bool] Whether to wrap nullable fields in a Value
class in order to distinguish between three cases:
- absent
- null
- non-null value
Example:
tristate_optionals: true
Creates data classes from your specified graphql schema.
type_overrides
: [Map] Specify how scalar types should be serialized
Example:
type_overrides:
CustomStringScalar:
name: String
CustomField:
name: CustomField
import: 'package:mypackage/custom_field.dart'
enum_fallbacks
: [Map] Specify fallback values to enum values in order to not break the serializer when
new enum values are added to the schema and the client has not updated to the new schema yet.
global_enum_fallbacks
: [bool] Add a generated fallback value for each enum value (except for ones that have a custom fallback value specified in the enum_fallbacks map).
Defaults to false.
Example:
global_enum_fallbacks: true # add a generated fallback value to all enums
enum_fallbacks:
MyEnumType: OTHER # except for the type 'MyEnumType', use the value 'OTHER' as fallback there
tristate_optionals
: [bool] Whether to wrap nullable fields in input types in a Value
class in order distinguish between three cases:
- absent
- null
- non-null value
Example:
tristate_optionals: true
Creates built_value
serializers for each built_value
class.
Please file feature requests and bugs at the issue tracker.