fromJson static method

Component fromJson(
  1. dynamic value
)

Returns a new Component instance and imports its values from value if it's a Map, null otherwise.

Implementation

// ignore: prefer_constructors_over_static_methods
static Component fromJson(dynamic value) {
  if (value is Map) {
    final json = value.cast<String, dynamic>();
    return Component(
      componentTypeId: mapValueOfType<int>(json, r'ComponentTypeId'),
      componentTypeName: mapValueOfType<String>(json, r'ComponentTypeName'),
      componentType: ComponentTypeInfo.fromJson(json[r'ComponentType']),
      connectedFrom: ComponentInfo.listFromJson(json[r'ConnectedFrom']),
      connectedTo: ComponentInfo.listFromJson(json[r'ConnectedTo']),
      spaces: SpaceInfo.listFromJson(json[r'Spaces']),
      systems: SystemInfo.listFromJson(json[r'Systems']),
      componentTypeEntity: mapValueOfType<Object>(json, r'ComponentTypeEntity'),
      spaceEntities: ApiClient.listFromJson(json[r'SpaceEntities']),
      subAssemblies: AssemblyInfo.listFromJson(json[r'SubAssemblies']),
      parentAssemblies: AssemblyInfo.listFromJson(json[r'ParentAssemblies']),
      documents: DocumentInfo.listFromJson(json[r'Documents']),
      documentEntities: ApiClient.listFromJson(json[r'DocumentEntities']),
      issues: IssueInfo.listFromJson(json[r'Issues']),
      contacts: EntityContact.listFromJson(json[r'Contacts']),
      createdBy: EntityContact.fromJson(json[r'CreatedBy']),
      modifiedBy: EntityContact.fromJson(json[r'ModifiedBy']),
      attributes: AttributeValue.listFromJson(json[r'Attributes']),
      footprint: Footprint.fromJson(json[r'Footprint']),
      mappedFrom: EntityMappingInfo.listFromJson(json[r'MappedFrom']),
      mappedTo: EntityMappingInfo.listFromJson(json[r'MappedTo']),
      ifcType: IfcType.fromJson(json[r'IfcType']),
      assetModelId: mapValueOfType<int>(json, r'AssetModelId'),
      entityId: mapValueOfType<int>(json, r'EntityId'),
      name: mapValueOfType<String>(json, r'Name'),
      description: mapValueOfType<String>(json, r'Description'),
      externalIdentifier: mapValueOfType<String>(json, r'ExternalIdentifier'),
      externalObjectType: mapValueOfType<String>(json, r'ExternalObjectType'),
      externalObjectName: mapValueOfType<String>(json, r'ExternalObjectName'),
      model: ModelInfo.fromJson(json[r'Model']),
      modelName: mapValueOfType<String>(json, r'ModelName'),
      dateCreated: mapDateTime(json, r'DateCreated', ''),
      dateModified: mapDateTime(json, r'DateModified', ''),
    );
  }
  return null;
}