Files
xueguang_flutter_app/lib/request/dto/room/room_user_dto.dart
2025-11-28 13:31:23 +08:00

78 lines
2.3 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
class RoomUserDto {
final int userId;
final int rtcUid;
int microphoneStatus;
int cameraStatus;
int speekerStatus;
final String wsClientId;
final String userName;
final String avatar;
/// 1是学生2是老师
final int userType;
List<String> 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<String, dynamic> 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<String>.from(json["files"]) : <String>[],
dataType: json["data_type"] ?? "",
handup: json["handup"] ?? 0,
online: json["online"] ?? 0,
);
}
Map<String, dynamic> 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,
};
}
static List<RoomUserDto> listFromJson(List<dynamic> data) =>
data.map((e) => RoomUserDto.fromJson(e)).toList();
@override
String toString() {
return 'RoomUserDto{userId: $userId, rtcUid: $rtcUid, microphoneStatus: $microphoneStatus, cameraStatus: $cameraStatus, speekerStatus: $speekerStatus, wsClientId: $wsClientId, userName: $userName, avatar: $avatar, userType: $userType, filesList: $filesList, dataType: $dataType, handup: $handup, online: $online,}';
}
}