from method

  1. @override
Graphql from(
  1. FieldElement element
)

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),
      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),
    nullable: obj.getField('nullable')?.toBoolValue() ?? Graphql.defaults.nullable,
    subfields: _convertMapToMap(obj.getField('subfields')?.toMapValue()),
    toGenerator: obj.getField('toGenerator')!.toStringValue(),
  );
}