import 'package:syncrow_app/features/devices/model/room_model.dart'; class SpaceModel { final int? id; final String? name; late List? rooms; SpaceModel({ required this.id, required this.name, required this.rooms, }); Map toJson() { return { 'id': id, 'name': name, 'rooms': rooms, }; } factory SpaceModel.fromJson(Map json) { return SpaceModel( id: int.parse(json['homeId']), name: json['homeName'], rooms: [], ); } static List fromJsonList(List jsonList) { return jsonList.map((item) => SpaceModel.fromJson(item)).toList(); } }