from method
Create a Annotation
based on a FieldElement
Implementation
@override
Graphql from(element) {
final obj = objectForField(element);
if (obj == null) {
return Graphql(
ignore: Graphql.defaults.ignore,
ignoreFrom: Graphql.defaults.ignoreFrom,
ignoreTo: Graphql.defaults.ignoreTo,
name: renameField(
element.name,
config?.fieldRename,
GraphqlSerializable.defaults.fieldRename,
),
nullable: Graphql.defaults.nullable,
enumAsString: Graphql.defaults.enumAsString,
);
}
return Graphql(
defaultValue: obj.getField('defaultValue')!.toStringValue(),
enumAsString: obj.getField('enumAsString')?.toBoolValue() ?? Graphql.defaults.enumAsString,
fromGenerator: obj.getField('fromGenerator')!.toStringValue(),
ignore: obj.getField('ignore')?.toBoolValue() ?? Graphql.defaults.ignore,
ignoreFrom: obj.getField('ignoreFrom')?.toBoolValue() ?? Graphql.defaults.ignoreFrom,
ignoreTo: obj.getField('ignoreTo')?.toBoolValue() ?? Graphql.defaults.ignoreTo,
name: obj.getField('name')?.toStringValue() ??
renameField(element.name, config?.fieldRename, GraphqlSerializable.defaults.fieldRename),
nullable: obj.getField('nullable')?.toBoolValue() ?? Graphql.defaults.nullable,
subfields: _convertMapToMap(obj.getField('subfields')?.toMapValue()),
toGenerator: obj.getField('toGenerator')!.toStringValue(),
);
}