user.dart 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import 'package:freezed_annotation/freezed_annotation.dart';
  2. import 'package:flutter/foundation.dart';
  3. part 'user.freezed.dart';
  4. part 'user.g.dart';
  5. @freezed
  6. class User with _$User {
  7. const factory User({
  8. String? country,
  9. String? countryName,
  10. String? userIp,
  11. String? accessToken,
  12. String? refreshToken,
  13. String? accountKey,
  14. String? accountPassword,
  15. int? createTime, // API 返回 int 类型的时间戳
  16. bool? geographyEea,
  17. int? memberLevel, // 会员等级 1 游客 2 普通用户 3 会员
  18. int? userLevel,
  19. int? expireTime,
  20. int? remainTime,
  21. bool? isExpired,
  22. bool? isTestUser,
  23. bool? isSubscribeUser,
  24. Account? account, // API 返回对象类型
  25. bool? activated, // 是否激活
  26. }) = _User;
  27. factory User.fromJson(Map<String, Object?> json) => _$UserFromJson(json);
  28. }
  29. @freezed
  30. class Account with _$Account {
  31. const factory Account({
  32. String? username,
  33. String? phone,
  34. String? email,
  35. String? wechat,
  36. String? qq,
  37. String? google,
  38. String? apple,
  39. }) = _Account;
  40. factory Account.fromJson(Map<String, Object?> json) =>
  41. _$AccountFromJson(json);
  42. }