fieldFromElement function
Future<FieldInfo>
fieldFromElement(
- GraphQLObject? clazz,
- Element method,
- DartType type,
- GeneratorCtx ctx,
- Map<
String, TypeParameterElement> generics,
Implementation
Future<FieldInfo> fieldFromElement(
GraphQLObject? clazz,
Element method,
DartType type,
GeneratorCtx ctx,
Map<String, TypeParameterElement> generics,
) async {
final annot = getFieldAnnot(clazz, method);
return FieldInfo(
gqlType: annot.type != null
? refer(annot.type!)
: inferType(
ctx.config.customTypes,
method,
method.name!,
type,
nullable: annot.nullable,
generics: generics,
),
name: annot.name ?? method.name!,
defaultValueCode: getDefaultValue(method),
getter: method is MethodElement
? await resolverFunctionBodyFromElement(ctx, method)
: method.name!,
inputs: method is MethodElement
? await inputsFromElement(ctx, method)
: const [],
isMethod: method is MethodElement,
nonNullable: annot.nullable != true &&
type.nullabilitySuffix == NullabilitySuffix.none,
fieldAnnot: annot,
description: getDescription(method, method.documentationComment),
deprecationReason: getDeprecationReason(method),
attachments: getAttachments(method),
);
}