mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 09:45:22 +00:00
30 lines
550 B
Dart
30 lines
550 B
Dart
import 'package:syncrow_app/features/devices/model/room_model.dart';
|
|
|
|
class SpaceModel {
|
|
final int? id;
|
|
final String? name;
|
|
final List<RoomModel>? rooms;
|
|
|
|
SpaceModel({
|
|
required this.id,
|
|
required this.name,
|
|
required this.rooms,
|
|
});
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'id': id,
|
|
'name': name,
|
|
'rooms': rooms,
|
|
};
|
|
}
|
|
|
|
factory SpaceModel.fromJson(Map<String, dynamic> json) {
|
|
return SpaceModel(
|
|
id: int.parse(json['homeId']),
|
|
name: json['homeName'],
|
|
rooms: [],
|
|
);
|
|
}
|
|
}
|