fromJson static method
Model
fromJson(
- dynamic value
)
Returns a new Model instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static Model fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return Model(
entities: ApiClient.listFromJson(json[r'Entities']),
asset: mapValueOfType<Object>(json, r'Asset'),
segment: mapValueOfType<Object>(json, r'Segment'),
attributeDefinitions: AttributeDefinitionEntity.listFromJson(json[r'AttributeDefinitions']),
spaces: ApiClient.listFromJson(json[r'Spaces']),
components: ApiClient.listFromJson(json[r'Components']),
componentTypes: ApiClient.listFromJson(json[r'ComponentTypes']),
levels: ApiClient.listFromJson(json[r'Levels']),
zones: ApiClient.listFromJson(json[r'Zones']),
facilities: ApiClient.listFromJson(json[r'Facilities']),
documents: ApiClient.listFromJson(json[r'Documents']),
contacts: ApiClient.listFromJson(json[r'Contacts']),
sites: ApiClient.listFromJson(json[r'Sites']),
applications: Application.listFromJson(json[r'Applications']),
forwardMappings: ModelMapping.listFromJson(json[r'ForwardMappings']),
reverseMappings: ModelMapping.listFromJson(json[r'ReverseMappings']),
roles: Role.listFromJson(json[r'Roles']),
permissions: UserPermissions.fromJson(json[r'Permissions']),
state: ModelStateEnum.fromJson(json[r'State']),
assetModelId: mapValueOfType<int>(json, r'AssetModelId'),
assetId: mapValueOfType<int>(json, r'AssetId'),
name: mapValueOfType<String>(json, r'Name'),
revision: mapValueOfType<String>(json, r'Revision'),
status: mapValueOfType<String>(json, r'Status'),
isCurrent: mapValueOfType<bool>(json, r'IsCurrent'),
uploadedById: mapValueOfType<String>(json, r'UploadedById'),
segmentName: mapValueOfType<String>(json, r'SegmentName'),
segmentId: mapValueOfType<String>(json, r'SegmentId'),
assetName: mapValueOfType<String>(json, r'AssetName'),
modelPath: mapValueOfType<String>(json, r'ModelPath'),
modelSize: mapValueOfType<int>(json, r'ModelSize'),
oneMeter: mapValueOfType<double>(json, r'OneMeter'),
originalAuthorId: mapValueOfType<int>(json, r'OriginalAuthorId'),
dateUploaded: mapDateTime(json, r'DateUploaded', ''),
dateProcessed: mapDateTime(json, r'DateProcessed', ''),
lastEntityId: mapValueOfType<int>(json, r'LastEntityId'),
processingStage: mapValueOfType<String>(json, r'ProcessingStage'),
processingStatus: mapValueOfType<String>(json, r'ProcessingStatus'),
);
}
return null;
}