class RoomUserDto { final int userId; final String rtcUid; int microphoneStatus; int cameraStatus; int speekerStatus; final String wsClientId; final String userName; final String avatar; /// 1是学生,2是老师 final int userType; final List filesList; final String dataType; int handup; int online; //0离线,1在线 RoomUserDto({ required this.userId, required this.rtcUid, required this.microphoneStatus, required this.cameraStatus, required this.speekerStatus, required this.wsClientId, required this.userName, required this.avatar, required this.userType, required this.filesList, required this.dataType, required this.handup, required this.online, }); factory RoomUserDto.fromJson(Map json) { return RoomUserDto( userId: json["user_id"] ?? 0, rtcUid: json["rtc_uid"] ?? "", microphoneStatus: json["microphone_status"] ?? 0, cameraStatus: json["camera_status"] ?? 0, speekerStatus: json["speeker_status"] ?? 0, wsClientId: json["ws_client_id"] ?? "", userName: json["user_name"] ?? "", avatar: json["avatar"] ?? "", userType: json["user_type"] ?? 0, filesList: json["files"] != null ? List.from(json["files"]) : [], dataType: json["data_type"] ?? "", handup: json["handup"] ?? 0, online: json["online"] ?? 0, ); } Map toJson() { return { "user_id": userId, "rtc_uid": rtcUid, "microphone_status": microphoneStatus, "camera_status": cameraStatus, "speeker_status": speekerStatus, "ws_client_id": wsClientId, "user_name": userName, "avatar": avatar, "user_type": userType, "files": filesList, "data_type": dataType, "handup": handup, "online": online, }; } }