DartEntity.parse constructor

DartEntity.parse(
  1. dynamic json
)

Parsing

Implementation

DartEntity.parse(dynamic json) {
  name = json['name'];

  for (final field in json['fields'] as Iterable) {
    // Ignore system types
    if ((field['name'] as String).startsWith('_')) {
      continue;
    }

    final dynamic typeObject = field['type'];

    String? type = _getTypeRecursive(typeObject);
    final bool isPrimitive = primitiveTypes.contains(type);
    if (isPrimitive) {
      type = convertGraphQLToDart(type);
    } else {
      needToExtractEntities.add(type);
    }

    fields.add(Field(field['name'], type));
  }
}