class Photo { final String id; final String url; final String caption; final bool active; const Photo({ required this.id, required this.url, required this.caption, required this.active, }); factory Photo.fromJson(Map json) { return Photo( id: json["_id"] as String? ?? "", url: json["url"] as String? ?? "", caption: json["caption"] as String? ?? "", active: json["active"] as bool? ?? true, ); } Map toJson() { return {"url": url, "caption": caption, "active": active}; } }