didvan-app/lib/models/chat_room/chat_room.dart

34 lines
776 B
Dart

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<String, dynamic> json) => ChatRoom(
id: json['id'],
type: json['type'],
updatedAt: json['updatedAt'],
unread: json['unread'],
lastMessage: LastMessage.fromJson(json['lastMessage']),
);
Map<String, dynamic> toJson() => {
'id': id,
'type': type,
'updatedAt': updatedAt,
'unread': unread,
'lastMessage': lastMessage.toJson(),
};
}