12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- // 用户相关的操作状态 State 类,用于 RiverPod 中 Provider 的定义
- class UserConfig {
- //用户的详情信息
- // UserProfile userProfile;
- //用户的登录Token
- String? token;
- //用户是否已经登录
- bool haslogin = false;
- //用户的 registrationId 推送标识
- String? registrationId;
- //用户的未读消息数量
- int unreadNotificationsCount = 0;
- // =================================== 插件自动生成-无需手动修改 ↓ ===================================
- //<editor-fold desc="Data Methods">
- UserConfig({
- this.token,
- required this.haslogin,
- required this.registrationId,
- required this.unreadNotificationsCount,
- });
- @override
- bool operator ==(Object other) =>
- identical(this, other) ||
- (other is UserConfig &&
- runtimeType == other.runtimeType &&
- token == other.token &&
- haslogin == other.haslogin &&
- registrationId == other.registrationId &&
- unreadNotificationsCount == other.unreadNotificationsCount);
- @override
- int get hashCode => token.hashCode ^ haslogin.hashCode ^ registrationId.hashCode ^ unreadNotificationsCount.hashCode;
- @override
- String toString() {
- return 'UserConfig{' +
- ' token: $token,' +
- ' haslogin: $haslogin,' +
- ' registrationId: $registrationId,' +
- ' unreadNotificationsCount: $unreadNotificationsCount,' +
- '}';
- }
- UserConfig copyWith({
- String? token,
- bool? haslogin,
- String? registrationId,
- int? unreadNotificationsCount,
- }) {
- return UserConfig(
- token: token ?? this.token,
- haslogin: haslogin ?? this.haslogin,
- registrationId: registrationId ?? this.registrationId,
- unreadNotificationsCount: unreadNotificationsCount ?? this.unreadNotificationsCount,
- );
- }
- Map<String, dynamic> toMap() {
- return {
- 'token': this.token,
- 'haslogin': this.haslogin,
- 'registrationId': this.registrationId,
- 'unreadNotificationsCount': this.unreadNotificationsCount,
- };
- }
- factory UserConfig.fromMap(Map<String, dynamic> map) {
- return UserConfig(
- token: map['token'] as String,
- haslogin: map['haslogin'] as bool,
- registrationId: map['registrationId'] as String,
- unreadNotificationsCount: map['unreadNotificationsCount'] as int,
- );
- }
- //</editor-fold>
- }
|