user_config.dart 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // 用户相关的操作状态 State 类,用于 RiverPod 中 Provider 的定义
  2. class UserConfig {
  3. //用户的详情信息
  4. // UserProfile userProfile;
  5. String? userName;
  6. //用户的登录Token
  7. String? token;
  8. //用户是否已经登录
  9. bool haslogin = false;
  10. //用户的 registrationId 推送标识
  11. String? registrationId;
  12. //用户的未读消息数量
  13. int unreadNotificationsCount = 0;
  14. /// =================================== 插件自动生成-无需手动修改 ↓ ===================================
  15. //<editor-fold desc="Data Methods">
  16. UserConfig({
  17. this.userName,
  18. this.token,
  19. required this.haslogin,
  20. this.registrationId,
  21. required this.unreadNotificationsCount,
  22. });
  23. @override
  24. bool operator ==(Object other) =>
  25. identical(this, other) ||
  26. (other is UserConfig &&
  27. runtimeType == other.runtimeType &&
  28. userName == other.userName &&
  29. token == other.token &&
  30. haslogin == other.haslogin &&
  31. registrationId == other.registrationId &&
  32. unreadNotificationsCount == other.unreadNotificationsCount);
  33. @override
  34. int get hashCode => userName.hashCode ^ token.hashCode ^ haslogin.hashCode ^ registrationId.hashCode ^ unreadNotificationsCount.hashCode;
  35. @override
  36. String toString() {
  37. return 'UserConfig{' +
  38. ' userName: $userName,' +
  39. ' token: $token,' +
  40. ' haslogin: $haslogin,' +
  41. ' registrationId: $registrationId,' +
  42. ' unreadNotificationsCount: $unreadNotificationsCount,' +
  43. '}';
  44. }
  45. UserConfig copyWith({
  46. String? userName,
  47. String? token,
  48. bool? haslogin,
  49. String? registrationId,
  50. int? unreadNotificationsCount,
  51. }) {
  52. return UserConfig(
  53. userName: userName ?? this.userName,
  54. token: token ?? this.token,
  55. haslogin: haslogin ?? this.haslogin,
  56. registrationId: registrationId ?? this.registrationId,
  57. unreadNotificationsCount: unreadNotificationsCount ?? this.unreadNotificationsCount,
  58. );
  59. }
  60. //</editor-fold>
  61. }