user_config.dart 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // 用户相关的操作状态 State 类,用于 RiverPod 中 Provider 的定义
  2. import 'package:domain/entity/user_me_entity.dart';
  3. class UserConfig {
  4. //用户的详情信息
  5. UserMeEntity? user;
  6. //用户的登录Token
  7. String? token;
  8. //用户姓名
  9. String? userName;
  10. //用户是否已经登录
  11. bool hasLogin = false;
  12. //用户的 registrationId 推送标识
  13. String? registrationId;
  14. //用户的未读消息数量
  15. int unreadNotificationsCount = 0;
  16. /// =================================== 插件自动生成-无需手动修改 ↓ ===================================
  17. //<editor-fold desc="Data Methods">
  18. UserConfig({
  19. this.user,
  20. this.token,
  21. this.userName,
  22. required this.hasLogin,
  23. this.registrationId,
  24. required this.unreadNotificationsCount,
  25. });
  26. UserConfig copyWith({
  27. UserMeEntity? user,
  28. String? token,
  29. String? userName,
  30. bool? hasLogin,
  31. String? registrationId,
  32. int? unreadNotificationsCount,
  33. }) {
  34. return UserConfig(
  35. user: user ?? this.user,
  36. token: token ?? this.token,
  37. userName: userName ?? this.userName,
  38. hasLogin: hasLogin ?? this.hasLogin,
  39. registrationId: registrationId ?? this.registrationId,
  40. unreadNotificationsCount: unreadNotificationsCount ?? this.unreadNotificationsCount,
  41. );
  42. }
  43. //</editor-fold>
  44. }