import 'last_message.dart'; class ChatRoom { final int id; final String type; final String updatedAt; final int unread; final LastMessage lastMessage; const ChatRoom({ required this.id, required this.type, required this.updatedAt, required this.unread, required this.lastMessage, }); factory ChatRoom.fromJson(Map json) => ChatRoom( id: json['id'], type: json['type'], updatedAt: json['updatedAt'], unread: json['unread'], lastMessage: LastMessage.fromJson(json['lastMessage']), ); Map toJson() => { 'id': id, 'type': type, 'updatedAt': updatedAt, 'unread': unread, 'lastMessage': lastMessage.toJson(), }; }