94 lines
2.4 KiB
Dart
94 lines
2.4 KiB
Dart
/// 用户 Domain 实体
|
||
///
|
||
/// 全局共享实体,被 auth / chat / contact 等多个 Feature 共用。
|
||
/// 纯 Dart 类,零 Flutter / 零网络 / 零 DB 依赖。
|
||
///
|
||
/// ## 数据流位置
|
||
///
|
||
/// ```
|
||
/// 服务端 JSON
|
||
/// → LoginData(Response DTO,data/remote/login_request.dart)
|
||
/// → LoginData.toEntity()
|
||
/// → ★ User ★ ← 你在这里
|
||
/// → ViewModel.state
|
||
/// → View 渲染
|
||
/// ```
|
||
class User {
|
||
final int uid;
|
||
final String? uuid;
|
||
final int? lastOnline;
|
||
final String? profilePic;
|
||
final String? profilePicGaussian;
|
||
final String? nickname;
|
||
final String? contact;
|
||
final String? countryCode;
|
||
final String? email;
|
||
final String? recoveryEmail;
|
||
final String? username;
|
||
final String? bio;
|
||
final int? relationship;
|
||
final String? userAlias;
|
||
final int? channelId;
|
||
final int? channelGroupId;
|
||
final String? hint;
|
||
|
||
const User({
|
||
required this.uid,
|
||
this.uuid,
|
||
this.lastOnline,
|
||
this.profilePic,
|
||
this.profilePicGaussian,
|
||
this.nickname,
|
||
this.contact,
|
||
this.countryCode,
|
||
this.email,
|
||
this.recoveryEmail,
|
||
this.username,
|
||
this.bio,
|
||
this.relationship,
|
||
this.userAlias,
|
||
this.channelId,
|
||
this.channelGroupId,
|
||
this.hint,
|
||
});
|
||
|
||
User copyWith({
|
||
int? uid,
|
||
String? uuid,
|
||
int? lastOnline,
|
||
String? profilePic,
|
||
String? profilePicGaussian,
|
||
String? nickname,
|
||
String? contact,
|
||
String? countryCode,
|
||
String? email,
|
||
String? recoveryEmail,
|
||
String? username,
|
||
String? bio,
|
||
int? relationship,
|
||
String? userAlias,
|
||
int? channelId,
|
||
int? channelGroupId,
|
||
String? hint,
|
||
}) {
|
||
return User(
|
||
uid: uid ?? this.uid,
|
||
uuid: uuid ?? this.uuid,
|
||
lastOnline: lastOnline ?? this.lastOnline,
|
||
profilePic: profilePic ?? this.profilePic,
|
||
profilePicGaussian: profilePicGaussian ?? this.profilePicGaussian,
|
||
nickname: nickname ?? this.nickname,
|
||
contact: contact ?? this.contact,
|
||
countryCode: countryCode ?? this.countryCode,
|
||
email: email ?? this.email,
|
||
recoveryEmail: recoveryEmail ?? this.recoveryEmail,
|
||
username: username ?? this.username,
|
||
bio: bio ?? this.bio,
|
||
relationship: relationship ?? this.relationship,
|
||
userAlias: userAlias ?? this.userAlias,
|
||
channelId: channelId ?? this.channelId,
|
||
channelGroupId: channelGroupId ?? this.channelGroupId,
|
||
hint: hint ?? this.hint,
|
||
);
|
||
}
|
||
} |