/// 直播间聊天消息模型 class LiveChatMessage { final String userId; final String userName; final String? avatar; final String content; final int timestamp; LiveChatMessage({ required this.userId, required this.userName, this.avatar, required this.content, required this.timestamp, }); factory LiveChatMessage.fromJson(Map json) { return LiveChatMessage( userId: json['userId'] ?? json['uid'] ?? '', userName: json['userName'] ?? json['nickName'] ?? '用户', avatar: json['avatar'] ?? json['profilePhoto'], content: json['content'] ?? json['message'] ?? '', timestamp: json['timestamp'] ?? DateTime.now().millisecondsSinceEpoch, ); } Map toJson() { return { 'userId': userId, 'userName': userName, 'avatar': avatar, 'content': content, 'timestamp': timestamp, }; } }