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. String? userName;
  9. //用户是否已经登录
  10. bool hasLogin = false;
  11. //用户的 registrationId 推送标识
  12. String? registrationId;
  13. //用户的未读消息数量
  14. int unreadNotificationsCount = 0;
  15. /// =================================== 插件自动生成-无需手动修改 ↓ ===================================
  16. //<editor-fold desc="Data Methods">
  17. UserConfig({
  18. this.user,
  19. this.token,
  20. this.userName,
  21. required this.hasLogin,
  22. this.registrationId,
  23. required this.unreadNotificationsCount,
  24. });
  25. UserConfig copyWith({
  26. UserMeEntity? user,
  27. String? token,
  28. String? userName,
  29. bool? hasLogin,
  30. String? registrationId,
  31. int? unreadNotificationsCount,
  32. }) {
  33. return UserConfig(
  34. user: user ?? this.user,
  35. token: token ?? this.token,
  36. userName: userName ?? this.userName,
  37. hasLogin: hasLogin ?? this.hasLogin,
  38. registrationId: registrationId ?? this.registrationId,
  39. unreadNotificationsCount: unreadNotificationsCount ?? this.unreadNotificationsCount,
  40. );
  41. }
  42. //</editor-fold>
  43. }