FieldDefinition.ofField constructor
FieldDefinition.ofField(
- GraphQLScanResult model,
- FieldDefinitionNode node, {
- required String entityName,
Implementation
FieldDefinition.ofField(
this.model,
FieldDefinitionNode node, {
required this.entityName,
}) : name = node.name.value,
original = node,
isId = node.isId,
isAutogenerateId = node.isAutogenerateId,
isReadOnly = node.isReadOnly,
isEager = node.isEager,
eagerPrefix = node.eagerPrefix,
isLazy = node.isLazy,
relationship = (node.missingDirective('relationship')
? null
: GraphQLRelation(
belongsTo: entityName,
fieldName: node.name.value,
isLazy: node.isLazy,
isEager: node.isEager,
eagerPrefix: node.eagerPrefix,
propsType: node.directives.getDirectiveValue('relationship', 'properties')?.stringValue,
)),
isWriteOnly = node.isWriteOnly,
isFlattened = node.isFlattened,
isRelationship = node.hasDirective('relationship'),
isList = node.type is ListTypeNode,
args = node.args,
typeNode = (node.directives.getDirectiveValue('relationship', 'properties')?.stringValue != null
? NamedTypeNode(name: NameNode(value: buildJoinRecordName(entityName, node.name.value)))
: (node.type is ListTypeNode ? (node.type as ListTypeNode).type : node.type)),
dartTypeName = node.type.toDartType(withNullability: false),
isNonNull = node.type.isNonNull;