55 lines
1.2 KiB
Dart
55 lines
1.2 KiB
Dart
class UserInfoModel {
|
|
UserInfoModel({
|
|
required this.userId,
|
|
required this.username,
|
|
required this.mobile,
|
|
required this.email,
|
|
required this.privacy,
|
|
required this.nickname,
|
|
required this.avatar,
|
|
this.google2fa,
|
|
});
|
|
|
|
String userId;
|
|
String username;
|
|
String? mobile;
|
|
String? email;
|
|
bool? privacy;
|
|
String? nickname;
|
|
String? avatar;
|
|
bool? google2fa;
|
|
|
|
factory UserInfoModel.fromJson(Map<String, dynamic> json) => UserInfoModel(
|
|
userId: json['user_id'].toString(),
|
|
username: json['username'],
|
|
mobile: json['mobile'],
|
|
email: json['email'],
|
|
privacy: json['privacy'],
|
|
nickname: json['nickname'],
|
|
avatar: json['avatar'],
|
|
google2fa: json['google2fa'],
|
|
);
|
|
|
|
factory UserInfoModel.empty() => UserInfoModel(
|
|
userId: '',
|
|
username: '',
|
|
mobile: '',
|
|
email: '',
|
|
privacy: true,
|
|
nickname: '',
|
|
avatar: '',
|
|
google2fa: false,
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'userId': userId,
|
|
'username': username,
|
|
'mobile': mobile,
|
|
'email': email,
|
|
'privacy': privacy,
|
|
'nickname': nickname,
|
|
'avatar': avatar,
|
|
'google2fa': google2fa,
|
|
};
|
|
}
|