You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.6 KiB
55 lines
1.6 KiB
// 用户基础信息实体类
|
|
class UserBaseData {
|
|
final bool matchmakerFlag;
|
|
final bool matchmakingCornerFlag;
|
|
final String nickName;
|
|
final String phone;
|
|
final String realName;
|
|
final String userId;
|
|
final int matchmakerType;
|
|
final bool? isOnline; // 在线状态
|
|
|
|
UserBaseData({
|
|
required this.matchmakerFlag,
|
|
required this.matchmakingCornerFlag,
|
|
required this.nickName,
|
|
required this.phone,
|
|
required this.realName,
|
|
required this.userId,
|
|
required this.matchmakerType,
|
|
this.isOnline,
|
|
});
|
|
|
|
// 从JSON映射创建实例
|
|
factory UserBaseData.fromJson(Map<String, dynamic> json) {
|
|
return UserBaseData(
|
|
matchmakerFlag: json['matchmakerFlag'] ?? false,
|
|
matchmakerType: json['matchmakerType'] ?? 0,
|
|
matchmakingCornerFlag: json['matchmakingCornerFlag'] ?? false,
|
|
nickName: json['nickName'] ?? '',
|
|
phone: json['phone'] ?? '',
|
|
realName: json['realName'] ?? '',
|
|
userId: json['userId'] ?? '',
|
|
isOnline: json['isOnline'] as bool?,
|
|
);
|
|
}
|
|
|
|
// 转换为JSON映射
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'matchmakerFlag': matchmakerFlag,
|
|
'matchmakerType': matchmakerType,
|
|
'matchmakingCornerFlag': matchmakingCornerFlag,
|
|
'nickName': nickName,
|
|
'phone': phone,
|
|
'realName': realName,
|
|
'userId': userId,
|
|
'isOnline': isOnline,
|
|
};
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return 'UserBaseData(matchmakerFlag: $matchmakerFlag, matchmakingCornerFlag: $matchmakingCornerFlag, nickName: $nickName, phone: $phone, realName: $realName, userId: $userId)';
|
|
}
|
|
}
|