Files
syncrow-web/lib/pages/spaces_management/all_spaces/model/connection_model.dart
Rafeek Alkhoudare c99b32fb81 cancel direction
2025-05-28 06:50:04 -05:00

29 lines
758 B
Dart

import 'package:syncrow_web/pages/spaces_management/all_spaces/model/space_model.dart';
class Connection {
final SpaceModel startSpace;
final SpaceModel endSpace;
Connection({
required this.startSpace,
required this.endSpace,
});
Map<String, dynamic> 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
};
}
static Connection fromMap(
Map<String, dynamic> map, Map<String, SpaceModel> spaces) {
return Connection(
startSpace: spaces[map['startUuid']]!,
endSpace: spaces[map['endUuid']]!,
);
}
}