Context class

Holds context between _GeneratorVisitor iterations.

Constructors

Context({required DocumentNode schema, required TypeDefinitionNodeVisitor typeDefinitionNodeVisitor, required GeneratorOptions options, required SchemaMap schemaMap, required List<Name> path, required TypeDefinitionNode? currentType, required Name? currentFieldName, required Name? currentClassName, Name? alias, TypeDefinitionNode? ofUnion, required List<Definition> generatedClasses, required List<QueryInput> inputsClasses, required List<FragmentDefinitionNode> fragments, Set<EnumName> usedEnums = const {}, Set<ClassName> usedInputObjects = const {}, int align = 0, bool log = true})
Instantiates context for _GeneratorVisitor iterations.

Properties

alias Name?
A string to replace the current class name.
final
align int
The indentation used to debugging purposes.
final
currentClassName Name?
The name of the class we're currently processing.
final
currentFieldName Name?
The name of the field we're currently processing.
final
currentType → TypeDefinitionNode?
The TypeDefinitionNode we're currently processing.
final
fragments List<FragmentDefinitionNode>
The current fragments considered in this visitor.
final
generatedClasses List<Definition>
The current generated definition classes of this visitor.
final
hashCode int
The hash code for this object.
no setterinherited
inputsClasses List<QueryInput>
The current generated input classes of this visitor.
final
log bool
If debug log should be printed.
final
ofUnion → TypeDefinitionNode?
If part of an union type, which TypeDefinitionNode it represents.
final
options GeneratorOptions
Other options parsed from build.yaml configuration.
final
path List<Name>
The path of data we're currently processing.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
schema → DocumentNode
The DocumentNode parsed from build.yaml configuration.
final
schemaMap SchemaMap
The SchemaMap being used on this iteration.
final
typeDefinitionNodeVisitor TypeDefinitionNodeVisitor
The DocumentNode parsed from build.yaml configuration.
final
usedEnums Set<EnumName>
A list of used enums (to filtered on generation).
final
usedInputObjects Set<ClassName>
A list of used input objects (to filtered on generation).
final

Methods

fullPathName() List<Name>
Returns the full class name
next({required TypeDefinitionNode nextType, Name? nextFieldName, Name? nextClassName, Name? alias, Nullable<TypeDefinitionNode?>? ofUnion, List<Definition>? generatedClasses, List<QueryInput>? inputsClasses, List<FragmentDefinitionNode>? fragments}) Context
Returns a copy of this context, with a new type on a new path.
nextTypeWithNoPath({required TypeDefinitionNode nextType, required Name nextFieldName, required Name nextClassName, Nullable<TypeDefinitionNode?>? ofUnion, Name? alias, List<Definition>? generatedClasses, List<QueryInput>? inputsClasses, List<FragmentDefinitionNode>? fragments}) Context
Returns a copy of this context, with next type, but on the first path.
nextTypeWithSamePath({required TypeDefinitionNode nextType, required Name? nextFieldName, required Name? nextClassName, Nullable<TypeDefinitionNode?>? ofUnion, Name? alias, List<Definition>? generatedClasses, List<QueryInput>? inputsClasses, List<FragmentDefinitionNode>? fragments}) Context
Returns a copy of this context, on the same path, but with a new type.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rollbackPath() Context
Returns a copy of this context, rolling back a item on path.
sameTypeWithNextPath({Name? nextFieldName, Name? nextClassName, Name? alias, Nullable<TypeDefinitionNode?>? ofUnion, List<Definition>? generatedClasses, List<QueryInput>? inputsClasses, List<FragmentDefinitionNode>? fragments, bool? log}) Context
Returns a copy of this context, with the same type, but on a new path.
sameTypeWithNoPath({Name? alias, Nullable<TypeDefinitionNode?>? ofUnion, List<Definition>? generatedClasses, List<QueryInput>? inputsClasses, List<FragmentDefinitionNode>? fragments}) Context
Returns a copy of this context, with the same type, but on the first path.
toString() String
A string representation of this object.
inherited
withAlias({Name? nextFieldName, Name? nextClassName, Name? alias}) Context
Returns a copy of this context, with the same type and path.

Operators

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