import 'package:syncrow_web/pages/spaces_management/all_spaces/model/space_model.dart'; class Connection { final SpaceModel startSpace; final SpaceModel endSpace; final String direction; Connection({required this.startSpace, required this.endSpace, required this.direction}); Map toMap() { return { 'startUuid': startSpace.uuid ?? 'unsaved-start-space-${startSpace.name}', // Fallback for unsaved spaces 'endUuid': endSpace.uuid ?? 'unsaved-end-space-${endSpace.name}', // Fallback for unsaved spaces 'direction': direction, }; } static Connection fromMap(Map map, Map spaces) { return Connection( startSpace: spaces[map['startUuid']]!, endSpace: spaces[map['endUuid']]!, direction: map['direction'], ); } }