ExportableEntity<I extends EntityId>.fromTypeAndJson constructor
ExportableEntity<I extends EntityId>.fromTypeAndJson (
- EntityType entityType,
- Map<
String, dynamic> json
Implementation
factory ExportableEntity.fromTypeAndJson(
EntityType entityType, Map<String, dynamic> json) {
switch (entityType) {
case EntityType.CUSTOMER:
return Customer.fromJson(json) as ExportableEntity<I>;
case EntityType.DASHBOARD:
return Dashboard.fromJson(json) as ExportableEntity<I>;
case EntityType.ASSET:
return Asset.fromJson(json) as ExportableEntity<I>;
case EntityType.ASSET_PROFILE:
return AssetProfile.fromJson(json) as ExportableEntity<I>;
case EntityType.DEVICE:
return Device.fromJson(json) as ExportableEntity<I>;
case EntityType.DEVICE_PROFILE:
return DeviceProfile.fromJson(json) as ExportableEntity<I>;
case EntityType.RULE_CHAIN:
return RuleChain.fromJson(json) as ExportableEntity<I>;
case EntityType.ENTITY_VIEW:
return EntityView.fromJson(json) as ExportableEntity<I>;
case EntityType.WIDGETS_BUNDLE:
return WidgetsBundle.fromJson(json) as ExportableEntity<I>;
default:
throw FormatException('Not exportable entity type: $entityType!');
}
}