SchematicPortData.fromJson constructor
Create a new SchematicPortData from JSON data.
Implementation
factory SchematicPortData.fromJson(Map<String, dynamic> json) =>
SchematicPortData(
id: json['id']?.toString() ?? '',
instanceId: json['nodeId']?.toString() ?? '', // JS still uses 'nodeId'
x: (json['x'] as num?)?.toDouble() ?? 0.0,
y: (json['y'] as num?)?.toDouble() ?? 0.0,
width: (json['width'] as num?)?.toDouble() ?? 10.0,
height: (json['height'] as num?)?.toDouble() ?? 10.0,
name: json['name']?.toString() ?? '',
direction: json['direction']?.toString() ?? 'INOUT',
side: json['side']?.toString() ?? 'EAST',
signalWidth: (json['signalWidth'] as num?)?.toInt() ?? 1,
);