mirror of
				https://github.com/dancojocaru2000/logic-circuits-simulator.git
				synced 2025-10-30 22:46:31 +02:00 
			
		
		
		
	For now just the code, without UI that shows the simulation. However, the code works. Also added ground work for visual designer.
		
			
				
	
	
		
			35 lines
		
	
	
	
		
			904 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
	
		
			904 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
| import 'package:freezed_annotation/freezed_annotation.dart';
 | |
| 
 | |
| part 'wiring.freezed.dart';
 | |
| part 'wiring.g.dart';
 | |
| 
 | |
| @freezed
 | |
| class Wiring with _$Wiring {
 | |
|   const factory Wiring({
 | |
|     required List<WiringInstance> instances,
 | |
|     required List<WiringWire> wires,
 | |
|   }) = _Wiring;
 | |
| 
 | |
|   factory Wiring.fromJson(Map<String, dynamic> json) => _$WiringFromJson(json);
 | |
| }
 | |
| 
 | |
| @freezed 
 | |
| class WiringInstance with _$WiringInstance {
 | |
|   const factory WiringInstance({
 | |
|     required String instanceId,
 | |
|     required String componentId,
 | |
|   }) = _WiringInstance;
 | |
| 
 | |
|   factory WiringInstance.fromJson(Map<String, dynamic> json) => _$WiringInstanceFromJson(json);
 | |
| }
 | |
| 
 | |
| @freezed
 | |
| class WiringWire with _$WiringWire {
 | |
|   const factory WiringWire({
 | |
|     required String wireId,
 | |
|     required String output,
 | |
|     required String input,
 | |
|   }) = _WiringWire;
 | |
| 
 | |
|   factory WiringWire.fromJson(Map<String, dynamic> json) => _$WiringWireFromJson(json);
 | |
| }
 |